4 * i3 - an improved dynamic tiling window manager
6 * © 2009-2010 Michael Stapelberg and contributors
8 * See file LICENSE for license information.
10 * debug.c: Contains debugging functions, especially FormatEvent, which prints unhandled events.
11 * This code is from xcb-util.
19 static const char *labelError[] = {
40 static const char *labelRequest[] = {
43 "ChangeWindowAttributes",
44 "GetWindowAttributes",
71 "ChangeActivePointerGrab",
121 "CopyColormapAndFree",
124 "ListInstalledColormaps",
141 "ChangeKeyboardMapping",
142 "GetKeyboardMapping",
143 "ChangeKeyboardControl",
144 "GetKeyboardControl",
146 "ChangePointerControl",
159 "SetModifierMapping",
160 "GetModifierMapping",
171 static const char *labelEvent[] = {
209 static const char *labelSendEvent[] = {
214 int format_event(xcb_generic_event_t *e) {
218 sendEvent = (e->response_type & 0x80) ? 1 : 0;
219 e->response_type &= ~0x80;
220 seqnum = *((uint16_t *) e + 1);
222 switch(e->response_type) {
224 DLOG("Error %s on seqnum %d (%s).\n",
225 labelError[*((uint8_t *) e + 1)],
227 labelRequest[*((uint8_t *) e + 10)]);
230 if (e->response_type > sizeof(labelEvent) / sizeof(char*))
232 DLOG("Event %s following seqnum %d%s.\n",
233 labelEvent[e->response_type],
235 labelSendEvent[sendEvent]);
237 case XCB_KEYMAP_NOTIFY:
238 DLOG("Event %s%s.\n",
239 labelEvent[e->response_type],
240 labelSendEvent[sendEvent]);
248 int handle_event(void *ignored, xcb_connection_t *c, xcb_generic_event_t *e) {
249 return format_event(e);