[Xcb] Feature Request: Function "xcb_test_for_event"

Josh Triplett josh at joshtriplett.org
Fri Apr 5 11:40:08 PDT 2013


On Fri, Apr 05, 2013 at 04:22:21PM +0200, Christian Heller wrote:
> I had formulated an XCB-related question at:
> http://stackoverflow.com/questions/15775281/need-for-xeventsqueueddisplay-queuedafterreading-in-xcb
> 
> It has now become a feature request, since the function I am seeking
> does not exist in XCB (yet).
> 
> You can find my proposal for the new function at the link mentioned above.
> Would you be so kind to consider my feature request for XCB 1.10?

Detecting events by polling periodically is highly inefficient; you
really want some mechanism that will block until you recieve an event.
So, first of all, I would not recommend adding an "xcb_test_for_event"
function, because I don't see any way you could use it without polling.

For your use case, you really want a blocking function like
xcb_wait_for_event, but without actually returning the event; it should
block until at least one event exists to return.

That still seems suboptimal for the purposes of most event loops (which
tend to use select, poll, or equivalent mechanisms to block on file
descriptors); however, I don't see an obvious way to integrate XCB into an
fd-based event loop, since you can't just block on the connection fd
(because that ignores any responses XCB might already read and queued).

> Just for this one feature request I didn't want to get a login to:
> http://bugs.freedesktop.org/

In general we do want to see bugs filed in Bugzilla, but in the case of
feature requests like this, discussion on the mailing list seems like a
fine place to start.

- Josh Triplett


More information about the Xcb mailing list