diff options
author | Uli Schlachter <psychon@znc.in> | 2015-04-04 17:37:10 +0200 |
---|---|---|
committer | Uli Schlachter <psychon@znc.in> | 2015-04-04 17:37:10 +0200 |
commit | cd2372e6ba1713d59afd8cb93849bd0a3415c320 (patch) | |
tree | b2f57d70c6b617dabc7c516c5fa3f5981f35b1a6 | |
parent | a66bb6b2320ebc81bd5cb6db7aa89ef5052932d7 (diff) |
Add a function for handling XGE events
Signed-off-by: Uli Schlachter <psychon@znc.in>
-rw-r--r-- | src/xcb_errors.c | 14 | ||||
-rw-r--r-- | src/xcb_errors.h | 14 |
2 files changed, 28 insertions, 0 deletions
diff --git a/src/xcb_errors.c b/src/xcb_errors.c index 5a469e2..266159d 100644 --- a/src/xcb_errors.c +++ b/src/xcb_errors.c @@ -144,6 +144,20 @@ const char *xcb_errors_get_name_for_minor_code(xcb_errors_context_t *ctx, return get_strings_entry(info->static_info->strings_minor, minor_code); } +const char *xcb_errors_get_name_for_xge_event(xcb_errors_context_t *ctx, + uint8_t major_code, uint16_t event_type) +{ + struct extension_info_t *info = ctx->extensions; + + while (info && info->major_opcode != major_code) + info = info->next; + + if (info == NULL || event_type >= info->static_info->num_xge_events) + return NULL; + + return get_strings_entry(info->static_info->strings_xge_events, event_type); +} + const char *xcb_errors_get_name_for_event(xcb_errors_context_t *ctx, uint8_t event_code, const char **extension) { diff --git a/src/xcb_errors.h b/src/xcb_errors.h index 757fd4a..a0af831 100644 --- a/src/xcb_errors.h +++ b/src/xcb_errors.h @@ -102,6 +102,20 @@ const char *xcb_errors_get_name_for_event(xcb_errors_context_t *ctx, uint8_t event_code, const char **extension); /** + * Get the name corresponding to some XGE or XKB event. XKB does not actually + * use the X generic event extension, but implements its own event multiplexing. + * This function also handles XKB's xkbType events as a event_type. + * + * @param ctx An errors context, created with @ref xcb_errors_context_new () + * @param major_code The extension's major code + * @param event_type The type of the event in that extension. + * @return A string allocated in static storage that contains a name for this + * event or NULL. + */ +const char *xcb_errors_get_name_for_xge_event(xcb_errors_context_t *ctx, + uint8_t major_code, uint16_t event_type); + +/** * Get the name corresponding to some error. * * @param ctx An errors context, created with @ref xcb_errors_context_new () |