[cairo] cairo and gdk/X11

Kalle Vahlman kalle.vahlman at gmail.com
Mon Jun 11 07:27:05 PDT 2007

2007/6/11, Tamas K Papp <tpapp at princeton.edu>:
> Hi Dan (and others),
> Thanks for the references, I found the thread and it was useful.  I
> will be using plain Xlib, not Gtk, since the latter is a mess with
> threads.

I don't think that's really true (depending on the definition of
"mess" of course), at least Andrew Cowie had an enlightening blog post
about this recently:


My personal experiences with threaded Gdk software are limited though, so...

> I still have one question.  I refresh (copy from the pixmap to the
> drawable in the window) each time
> 1. X asks for it via an expose event,
> 2. cairo draws on the pixmap.
> I could call refresh explicitly each time (2) happens, but I wonder if
> there is a neater way, since my library supports various surfaces and
> I would have to handle one of them differently.
> b. a callback function that gets called each time the surface is
> modified.

With the X Damage extension you can receive events from the X server
whenever a pixmap (or a window) is "damaged", ie. it has been drawn
to. You can then clear the damage state and update the contents.

You can get hints on how to use it from this nice composite tutorial:


Kalle Vahlman, zuh at iki.fi
Powered by http://movial.fi
Interesting stuff at http://syslog.movial.fi

More information about the cairo mailing list