[cairo] Dealing with drawingArea update (refresh) for multiple drawings.

Carlo Wood carlo at alinoe.com
Sun Aug 27 04:52:34 PDT 2006

On Sat, Aug 26, 2006 at 10:58:39AM -0300, Gustavo Sikora wrote:
> Using gdk_invalidate_region within my expose_event_callback I manage
> to draw as soon as I insert an element, but yet it's only drawing
> once. If there's more elements, they are not drawn.

You should call invalidate functions outside the expose function.
The expose function is called from the mainloop if there are
any invalidated regions. If you invalidate new regions while
(already) inside the expose function, then I don't know what
will happen (but they won't be drawn that very call to expose).

Normally (in your case) exposing is double buffered. That means
that when your expose function is called, widget->window is actually
an off-screen buffer that you will be assembling your drawing in.
Once returning from the expose function, ONLY the region that was
passed to the expose function is copied onto the screen (after all,
it can't rely on you having updated any other part); Therefore, adding
additional invalidated regions (and drawing them) inside the expose
function sounds like a bad idea to me.

Carlo Wood <carlo at alinoe.com>

More information about the cairo mailing list