Re: [gtk-list] [patch] gtkviewport optimizations




Patrice Fortier <Patrice.Fortier@aquarel.fr> writes:

> extract from gtk-fortier-980128-0.patch.README:
> 
> This patch is a an optimization (cleanup) of the gtkviewport widget.
> 
> The viewport widget has 3 windows:
> the main window (wigdet->window), a clipping window and a window
> which contains the child widget.
> The only window which needs to get events (expose, clicks...) is
> the main window. The 2 others almost never recieve any event, and
> when they do, they don't do anything.
> This patch explicitly tells the X server that these 2 windows 
> don't care about events.

I'm not sure this is right (it might be right for the clipping
window, but not for the child window). The child window needs
to get expose events (see below) and should also get whatever
was set with gtk_widget_set_events.

> A second optimization, is for expose events handling in the viewport
> widget. When the viewport recieved an expose event, it sent it to
> its child widget. This is useless.
> If the child widget is a NO_WINDOW it won't handle it, and if it
> is not a NO_WINDOW, X already did the job and all we have is a
> duplicated expose event for the child widget.
> As the compressed expose stuff is not (yet) in gtk, we will
> avoid a significant number of useless (unworthy) expose events.

Try putting a Frame inside the viewport. it's NO_WINDOW, and
uses Expose events to draw its window. The code in gtkviewport.c
currently reads:

      child_event = *event;
      if (bin->child &&
	  GTK_WIDGET_NO_WINDOW (bin->child) &&
	  gtk_widget_intersect (bin->child, &event->area, &child_event.area))
	gtk_widget_event (bin->child, (GdkEvent*) &child_event);

This does look like it should be,

      if (bin->child && event->window == viewport->bin_window &&
          ...

I'll have to take a look at your patch when it makes its way
out of incoming and see exactly what your changes are, though...

Thanks for working on this,

                                        Owen



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