[Xcb] [PATCH v2] Add missing defines for X11 opcodes

Klemens Baum klemensbaum at gmail.com
Sun Dec 27 13:40:17 PST 2015


This patch adds the XCB_ERROR and XCB_REPLY symbolic constants.
These are intended to be used for disambiguating xcb_generic_event_t.
---
I did see XCB_GE_GENERIC at first. Since it already exists, xcb_in.c
will now use use that.

I've also dropped the reorderings, making the diff is easier to read.

 src/xcb.h    | 6 ++++++
 src/xcb_in.c | 8 ++------
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/xcb.h b/src/xcb.h
index 8dc440d..f7f60eb 100644
--- a/src/xcb.h
+++ b/src/xcb.h
@@ -117,6 +117,9 @@ typedef struct {
     int index;  /**< index of the current iterator */
 } xcb_generic_iterator_t;

+/** Opcode for xcb_generic_reply_t. */
+#define XCB_REPLY 1
+
 /**
  * @brief Generic reply.
  *
@@ -162,6 +165,9 @@ typedef struct {
     uint32_t full_sequence;  /**< full sequence */
 } xcb_ge_event_t;

+/** Opcode for xcb_generic_error_t. */
+#define XCB_ERROR 0
+
 /**
  * @brief Generic error.
  *
diff --git a/src/xcb_in.c b/src/xcb_in.c
index bab4bc7..5beff11 100644
--- a/src/xcb_in.c
+++ b/src/xcb_in.c
@@ -52,10 +52,6 @@
 #include "xcbext.h"
 #include "xcbint.h"

-#define XCB_ERROR 0
-#define XCB_REPLY 1
-#define XCB_XGE_EVENT 35
-
 struct event_list {
     xcb_generic_event_t *event;
     struct event_list *next;
@@ -145,7 +141,7 @@ static int event_special(xcb_connection_t *c,
     struct xcb_ge_special_event_t *ges = (void *) event->event;

     /* Special events are always XGE events */
-    if ((ges->response_type & 0x7f) != XCB_XGE_EVENT)
+    if ((ges->response_type & 0x7f) != XCB_GE_GENERIC)
         return 0;

     for (special_event = c->in.special_events;
@@ -250,7 +246,7 @@ static int read_packet(xcb_connection_t *c)
     }

     /* XGE events may have sizes > 32 */
-    if ((genrep.response_type & 0x7f) == XCB_XGE_EVENT)
+    if ((genrep.response_type & 0x7f) == XCB_GE_GENERIC)
         eventlength = genrep.length * 4;

     bufsize = length + eventlength + nfd * sizeof(int)  +
--
2.6.4



More information about the Xcb mailing list