Re: [gtk-list] Re: GraphicsExpose (was Re: About the About Box)




Peter Mattis <petm@scam.XCF.Berkeley.EDU> writes:

> Owen Taylor writes:
> >      gdk_draw_pixmap (widget->window,
> >		       scroll_test_gc,
> >		       widget->window,
> >		       ...)
> >
> >      /* Make sure graphics expose events are processed before scrolling
> >       * again */
> >      
> >      while ((event = gdk_event_get_graphics_expose (widget->window)) != NULL)
> >	{
> >	  gtk_widget_event (widget, event);
> >	  if (event->expose.count == 0)
> >	    break;
> >	}
> 
> I thought this is what I originally tried to do to fix the scrolling
> problems in the gimp. That was the original reason for writing
> "gdk_event_get" (which, btw, did work when originally written). 

gdk_event_get was broken by people (including me) adding lots of stuff
into gdk_event_translate that is stateful and can't be called for
the same event more than once.

> I'm fairly positive that the scrolling bugs for gimp image windows
> were fixed at one point in a manner similar to the above. The theory
> of operation seems sound to me.

There is a fix in there now that is 90% right for scrolling with
the middle mouse button. (The same fix isn't present for scrolling
with the scrollbars)

It isn't 100% right because it (via gdk_event_get) uses XCheckIfEvent,
and the relevant GraphicsExpose events could still be at the
server. (I haven't actually seen this happen, but I think it
could happen) So it is necessary to use XIfEvent, and since
you don't want to block unnecessarily, looking for NoExpose events
is also necessary.  So it seemed easiest just to add a special
purpose function.

Regards,
                                        Owen






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