[Xcb] [RFC libxcb 3/5] Make get_events aware of full_sequence in queue

Daniel Martin consume.noise at gmail.com
Tue Jun 4 15:52:04 PDT 2013


With this, get_event() and get_event_locked() optionally hand out the
full sequence number for an event.

Signed-off-by: Daniel Martin <consume.noise at gmail.com>
---
 src/xcb_in.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/xcb_in.c b/src/xcb_in.c
index 207a2ac..e82baff 100644
--- a/src/xcb_in.c
+++ b/src/xcb_in.c
@@ -242,13 +242,15 @@ static int read_packet(xcb_connection_t *c)
     return 1; /* I have something for you... */
 }
 
-static xcb_generic_event_t *get_event(xcb_connection_t *c)
+static xcb_generic_event_t *get_event(xcb_connection_t *c, uint64_t *full_sequence)
 {
     struct event_list *cur = c->in.events;
     xcb_generic_event_t *ret;
     if(!c->in.events)
         return 0;
     ret = cur->event;
+    if (full_sequence)
+        *full_sequence = cur->full_sequence;
     c->in.events = cur->next;
     if(!cur->next)
         c->in.events_tail = &c->in.events;
@@ -256,7 +258,7 @@ static xcb_generic_event_t *get_event(xcb_connection_t *c)
     return ret;
 }
 
-static xcb_generic_event_t *get_event_locked(xcb_connection_t *c, xcb_rcv_style_t style)
+static xcb_generic_event_t *get_event_locked(xcb_connection_t *c, xcb_rcv_style_t style, uint64_t *full_sequence)
 {
     xcb_generic_event_t *ret = NULL;
 
@@ -547,17 +549,17 @@ int xcb_poll_for_reply(xcb_connection_t *c, unsigned int request, void **reply,
 
 xcb_generic_event_t *xcb_wait_for_event(xcb_connection_t *c)
 {
-    return get_event_locked(c, XCB_RCV_WAIT);
+    return get_event_locked(c, XCB_RCV_WAIT, NULL);
 }
 
 xcb_generic_event_t *xcb_poll_for_event(xcb_connection_t *c)
 {
-    return get_event_locked(c, XCB_RCV_POLL);
+    return get_event_locked(c, XCB_RCV_POLL, NULL);
 }
 
 xcb_generic_event_t *xcb_poll_for_queued_event(xcb_connection_t *c)
 {
-    return get_event_locked(c, XCB_RCV_QUEUED);
+    return get_event_locked(c, XCB_RCV_QUEUED, NULL);
 }
 
 xcb_generic_error_t *xcb_request_check(xcb_connection_t *c, xcb_void_cookie_t cookie)
-- 
1.8.3



More information about the Xcb mailing list