summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorUli Schlachter <psychon@znc.in>2015-04-06 16:16:32 +0200
committerUli Schlachter <psychon@znc.in>2015-04-06 16:16:32 +0200
commit54e2145e1198a892312c571098298baa56fb4d05 (patch)
treed2a4a8cdeb367b832c9ff631f76e1c717c8db5ba /src
parent0095e4318563875ceb3952fae7fbaa758ab71186 (diff)
Ignore "event sent" flag in event codes
The highest bit of an event code shows if the event was generated by the X11 server or via the SendEvent request. Ignore this bit in all places that handle event codes. Signed-off-by: Uli Schlachter <psychon@znc.in>
Diffstat (limited to 'src')
-rw-r--r--src/xcb_errors.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/xcb_errors.c b/src/xcb_errors.c
index ab9837a..428e7be 100644
--- a/src/xcb_errors.c
+++ b/src/xcb_errors.c
@@ -178,6 +178,7 @@ const char *xcb_errors_get_name_for_core_event(xcb_errors_context_t *ctx,
struct extension_info_t *best = NULL;
struct extension_info_t *next;
+ event_code &= 0x7f;
if (extension)
*extension = NULL;
@@ -250,6 +251,7 @@ const char *xcb_errors_get_name_for_xcb_event(xcb_errors_context_t *ctx,
xcb_generic_event_t *event, const char **extension)
{
struct extension_info_t *xkb;
+ uint8_t response_type;
if (extension)
*extension = NULL;
@@ -261,7 +263,8 @@ const char *xcb_errors_get_name_for_xcb_event(xcb_errors_context_t *ctx,
while (xkb != NULL && strcmp(xkb->static_info->name, "xkb") != 0)
xkb = xkb->next;
- if (event->response_type == XCB_GE_GENERIC) {
+ response_type = event->response_type & 0x7f;
+ if (response_type == XCB_GE_GENERIC) {
/* XGE offers extension's major code and event sub-type. */
xcb_ge_generic_event_t *ge = (void *) event;
if (extension)
@@ -271,7 +274,7 @@ const char *xcb_errors_get_name_for_xcb_event(xcb_errors_context_t *ctx,
ge->extension, ge->event_type);
}
if (xkb != NULL && xkb->first_event != 0
- && event->response_type == xkb->first_event) {
+ && response_type == xkb->first_event) {
/* There is no nice struct that defines the common fields for
* XKB events, but the event type is always in the second byte.
* In xcb_generic_event_t, this is the pad0 field.
@@ -282,5 +285,5 @@ const char *xcb_errors_get_name_for_xcb_event(xcb_errors_context_t *ctx,
xkb->major_opcode, event->pad0);
}
/* Generic case, decide only based on the response_type. */
- return xcb_errors_get_name_for_core_event(ctx, event->response_type, extension);
+ return xcb_errors_get_name_for_core_event(ctx, response_type, extension);
}