mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-26 14:45:58 +01:00
xcb error: get unhandled events names
This provides more friendly debug messages for unhandled events, for example: [xwayland/xwm.c:1033] unhandled X11 event: FocusOut (10) [xwayland/xwm.c:1033] unhandled X11 event: MappingNotify (34)
This commit is contained in:
parent
8026cd2a06
commit
f481791669
1 changed files with 28 additions and 2 deletions
|
@ -1002,6 +1002,33 @@ log_raw:
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void xwm_handle_unhandled_event(struct wlr_xwm *xwm, xcb_generic_event_t *ev) {
|
||||||
|
#ifdef WLR_HAS_XCB_ERRORS
|
||||||
|
xcb_errors_context_t *err_ctx;
|
||||||
|
if (xcb_errors_context_new(xwm->xcb_conn, &err_ctx)) {
|
||||||
|
wlr_log(L_DEBUG, "Could not allocate context for unhandled X11 event: %u",
|
||||||
|
ev->response_type);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *extension;
|
||||||
|
const char *event_name =
|
||||||
|
xcb_errors_get_name_for_xcb_event(err_ctx, ev, &extension);
|
||||||
|
if (!event_name) {
|
||||||
|
wlr_log(L_DEBUG, "no name for unhandled event: %u",
|
||||||
|
ev->response_type);
|
||||||
|
xcb_errors_context_free(err_ctx);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
wlr_log(L_DEBUG, "unhandled X11 event: %s (%u)", event_name, ev->response_type);
|
||||||
|
|
||||||
|
xcb_errors_context_free(err_ctx);
|
||||||
|
#else
|
||||||
|
wlr_log(L_DEBUG, "unhandled X11 event: %u", ev->response_type);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/* This is in xcb/xcb_event.h, but pulling xcb-util just for a constant
|
/* This is in xcb/xcb_event.h, but pulling xcb-util just for a constant
|
||||||
* others redefine anyway is meh
|
* others redefine anyway is meh
|
||||||
*/
|
*/
|
||||||
|
@ -1062,8 +1089,7 @@ static int x11_event_handler(int fd, uint32_t mask, void *data) {
|
||||||
xwm_handle_xcb_error(xwm, (xcb_value_error_t *)event);
|
xwm_handle_xcb_error(xwm, (xcb_value_error_t *)event);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
wlr_log(L_DEBUG, "unhandled X11 event: %d",
|
xwm_handle_unhandled_event(xwm, event);
|
||||||
event->response_type);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
free(event);
|
free(event);
|
||||||
|
|
Loading…
Reference in a new issue