[cairo] which operations modify the canvas?

Tamas K Papp tpapp at Princeton.EDU
Wed Jun 20 11:55:14 PDT 2007


On Wed, Jun 20, 2007 at 02:20:10PM -0400, Behdad Esfahbod wrote:
> On Wed, 2007-06-20 at 13:56 -0400, Carl Worth wrote:
> > 
> > Anything is possible, really. But I'm a bit confused as to what
> > problem you are running into. You really shouldn't be needing to call
> > XSync to get results to appear, (and if you are, I fear negative
> > performance impacts). 
> 
> Well you need to do something to make sure xlib flushes its buffer.
> With Gtk+, the main loop does that implicitly (by asking for next X
> event).

The situation is the following:

I start a thread ("background"), which creates an X11 window, a cairo
surface and context on a pixmap (pixmap uses XDamage), and enters into
an event loop, handling exposure and damage notify events.

Then, in another thread ("foreground"), I draw on the canvas using
cairo commands.  The event loop in background uses XNextEvent which
does flush the buffer, but if the canvas was drawn on in foreground
after the last XNextEvent in background, this doesn't happen.

I can always flush the buffer from the application, but as I am
writing Common Lisp bindings for Cairo, it would be nicer if I could
handle it in Cairo or X11 somehow.

A callback function that would be called for operations on the X11
surface would be a nice thing --- it doesn't make sense for any other
surface, but would here.  Of course, any other suggestions would be
appreciated.

Thanks,

Tamas




More information about the cairo mailing list