Re: expose events in gtk2



Dov Grobgeld <dov imagic weizmann ac il> writes:

> After finishing the porting of my image viewer widget I am trying to
> understand why the gtk2 version is much slower than the gtk version.
> One reason that I found is that every time the window with the 
> gtk2 widget is focused by the window manager, an exposure event is
> generated for the whole window. An additional exposure events are also
> generated on button release. In the gtk1.2 version I only get exposure
> events when I expect them. I.e. when the window is first mapped, and
> when an area of the widget was obscured, and subsequently exposed.

We had the same problem in GIMP, when every time the canvas gained
or lost focus the whole widget was exposed. My workaround was to
implement the focus stuff myself:

gboolean
gimp_display_shell_canvas_focus_in (GtkWidget        *widget,
                                    GdkEventFocus    *fevent,
                                    GimpDisplayShell *shell)
{
  GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);

  return TRUE;
}

gboolean
gimp_display_shell_canvas_focus_out (GtkWidget        *widget,
                                     GdkEventFocus    *fevent,
                                     GimpDisplayShell *shell)
{
  GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);

  return TRUE;
}

Hope this helps...

ciao,
--mitch



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