[Xcb] [Bug 29657] New: missing main loop integration API

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Wed Aug 18 15:48:00 PDT 2010


https://bugs.freedesktop.org/show_bug.cgi?id=29657

           Summary: missing main loop integration API
           Product: XCB
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: medium
         Component: Library
        AssignedTo: xcb at lists.freedesktop.org
        ReportedBy: hp at pobox.com
         QAContact: xcb at lists.freedesktop.org


To use XCB nicely with a main loop instead of threads, I think the following
are missing.

1. a way to see if any events or replies are buffered (like XPending, but no
IO). Used in the "prepare" and "check" steps of GLib main loop for example.
Ideally, separate xcb_has_events and xcb_has_replies perhaps. Errors are events
if treated as events and replies if checked.

2. a way to "read from socket into internal queue without returning any events
or replies". Used in GLib "check" step for example, followed by the XPending
type thing.

3. a way to "partially flush with a single write() call" - xcb_partial_flush?

Then in something like GTK, you would have:

* a GSource for the event queue, similar to current Xlib one. Uses current 
xcb_poll_for_event in dispatch(), but uses the new API for prepare and check.
Can also poll on writability and do the "xcb_partial_flush" if socket is
writeable, so we never get requests that remain unsent if the main loop runs.

* a GSource that lets you add a callback to invoke when a specific reply
arrives. This would need to do "read() just once from socket" in its check(),
and then xcb_poll_for_reply

Right now the source that nonblockingly auto-flushes in main loop is not
possible, and the source that does a callback when a specific reply arrives I
don't think is possible either. (without threads, that is.)

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the Xcb mailing list