[Xcb] No XIfEvent like function in XCB?

Carsten Meier cm at trexity.de
Tue Sep 16 05:07:16 PDT 2008

Mornin' everybody :)

Am Mon, 15 Sep 2008 10:25:55 -0700
schrieb Barton C Massey <bart at cs.pdx.edu>:

> In message <20080915121739.3f312322 at before> you wrote:
> > for Expose-events it works that way. But after scrolling
> > with XCopyArea I used to query corresponding
> > GraphicsExpose-events synchronously with XIfEvent to
> > archieve a behaviour similar to Windows' ScrollDC function
> > (sorry for that ;) ) which returns the uncovered region.
> Still not getting the problem.  You have to have some sort
> of event loop processing that will repair damage anyway.
> Why not just let that take care of your damage from
> XCopyArea?

Because I need similar behaviour across plattforms.

> In any case, as far as I know existing servers will generate
> the GraphicsExpose events immediately after XCopyArea
> completes.  So it should work (although I haven't tried it)
> to just call xcb_copy_area_checked() and
> xcb_request_check(), then call xcb_wait_for_event() until
> you get the GraphicsExpose event with count 0.

But there may be other events in the queue (before the GraphicsExpose
events) which have to be dispatched. And dispatching events in multiple
places is the Windows-way that I won't go.

> It's not likely to happen.  See the email list archives for
> a detailed discussion.  The thread-transparency of XCB
> resulted in some design decisions that make it hard to do
> this: there really isn't a "queue like in Xlib" in XCB.

I have found this post which is very useful to me:
Parts of it should go to the tutorial.

> There's code in util/events that layers an event callback
> mechanism on top of XCB.  If you just have to have
> callbacks, build on top of that---there's a callback there
> for GraphicsExpose events.  It's undocumented and provides
> kind of an ugly abstraction; please feel free to improve on
> it.  In particular, if you feel that you need to enqueue
> events rather than handling them for some reason, this would
> be the place to put queueing code.

Im currently thinking of an event-dispatching-mechanism for C++, but not
quite sure how to do it. (Any suggestions for that?) I will then build
an own queue on top of it to archieve XIfEvent behaviour as proposed by
you and the above post.


More information about the Xcb mailing list