Re: 'synchronous redraw' with a DrawingArea

Pascal Ognibene <pascal ognibene libertysurf fr> writes:

> 1) I'm not sure it would work if X11 or GTK try to merge the expose events
> for optimization. This mostly depends on the timing I guess

You should just call gtk_widget_queue_draw() or
gtk_widget_queeu_draw_area(). That will make gtk+ to eventually call
the expose handler of that widget. 

Gtk+ does merge expose events together, but it will keep track of the
entire area that needs to be redrawn, so things will work regardless
of timing.

> 2) if it works there would be one useless redraw...

In this particular case gtk+ will be able to ignore the expose event
sent by the X server:

        - if the expose event arrives *before* gtk+ gets around to
          calling the expose handler of your widget, it will just be
          merged in with the redraw you already scheduled.

        - if the expose event arrives *after* gtk+ called your expose
          handler, gtk+ checks if the X server knew about the painting
          when it generated the expose events. If it didn't, the
          expose event can just be thrown away.


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