Re: Some questions on double buffering and expose in gtk2.



On Mon, 2002-10-28 at 16:48, Havoc Pennington wrote:
> 
> Martin Sevior <msevior physics unimelb edu au> writes:
> > 	     My solution was to put the redraw into a gtk_idle function so the
> > redraw happens after gtk finishes doing whatever it is doing. 
> >
> 
> I really doubt that's the right fix. expose_event is _already_ called
> out of an idle, unless gdk_window_process_updates() has been called
> somewhere.
> 
> One case where this happens is if you are sharing a GdkWindow with a
> scrollbar (scrollbar is a NO_WINDOW widget, maybe your widget is
> too). That could process_updates() on your widget as a side effect.
> 

The bug showed up most obviously in the "Insert Symbol" AbiWord dialog.
If you have an AbiWord handy fire up the insert symbol dialog while I
explain:

After the drop down combo box that lists the available fonts retracted,
there was big white patch in the Drawing Area where the symbols are.
It also shows up in other widgets with previews where the contents of
the preview are not displayed on the initial expose.

I think about what you said. I suspect that there is GTK 2 bug here to
do with merging expose events between widgets and drawing areas. I'll
see if I can come up with an exact test case to either isolate the bug
or find out what we're doing wrong.

> But widgets that scroll should be calling process_updates() themselves
> anyway when the scroll adjustment changes, or the scrolling will look
> funny. See GtkTextView for an extremely nontrivial and complicated
> example...
> 
> Anyway, if your code works in an idle and doesn't work in
> expose_event, I would say there's still a bug in there, you're just
> hiding it.
>

Well it used to work fine in gtk 1.2. The code is absolutely straight
forward. On expose event, redraw the entire preview (don't bother with
clipping or anything). I've tried returning both TRUE or FALSE from a
gboolean callback. It makes no difference.

If it is something we're doing wrong, we should find out what and
document it because if it is not a bug in gtk2 it is very hard to get
the desired behavior.
  
> > Maybe the issue has something to do with drawing with xft enabled
> > FreeType.
> 
> Maybe, but that should not make a difference.
> 

Thanks very much for your help.

Cheers

Martin






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