Re: Should GtkWidget::draw be RUN_LAST?




Federico Mena Quintero <federico@nuclecu.unam.mx> writes:

> >  Two separate questions - should GtkWidget::draw be RUN_LAST,
> >  and can we change it to that at this point.
> [snippity snip]
> 
> This sounds like a good idea.
> 
> >  (Having a real virtualized paint method be used throughout
> >   GTK+ would be big improvement actually, and has been
> >   discussed for a long time. But that certainly isn't a 
> >   pre-1.2 change)
> 
> What would this be used for?  Something like 
> 
> 	widget::paint()
> 	{
> 		/* spew random garbage to the display */
> 	}
> 
> 	widget::draw()
> 	{
> 		widget::paint();
> 	}
> 
> 	widget::expose()
> 	{
> 		widget::paint();
> 	}
> 
> If that is the case, why do we need the three methods? :-)

Take a look at any container widget. For a container widget,
draw() and expose_event() are typically identical, except
for the manner in which the signal is propagated to
their children. There are also some ugly differences
in the interpretation of the event area.

So, for a lot of widgets you have nearly identical draw()
and expose() calling a third paint() function that is
specific to the widget. There's a lot of code duplication 
that could be saved by virtualizing paint(). (I'm not saying 
that this is necesarily right thing to do in the future - perhaps
a more radical step should be taken draw() and expose() should
be abandoned entirely in favor of of a paint())

Regards,
                                        Owen



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]