2 #define I3__FILE__ "debug.c"
4 * vim:ts=4:sw=4:expandtab
6 * i3 - an improved dynamic tiling window manager
7 * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
9 * debug.c: Debugging functions, especially FormatEvent, which prints unhandled
10 * events. This code is from xcb-util.
18 static const char *labelError[] = {
39 static const char *labelRequest[] = {
42 "ChangeWindowAttributes",
43 "GetWindowAttributes",
70 "ChangeActivePointerGrab",
120 "CopyColormapAndFree",
123 "ListInstalledColormaps",
140 "ChangeKeyboardMapping",
141 "GetKeyboardMapping",
142 "ChangeKeyboardControl",
143 "GetKeyboardControl",
145 "ChangePointerControl",
158 "SetModifierMapping",
159 "GetModifierMapping",
170 static const char *labelEvent[] = {
208 static const char *labelSendEvent[] = {
213 int format_event(xcb_generic_event_t *e) {
217 sendEvent = (e->response_type & 0x80) ? 1 : 0;
218 e->response_type &= ~0x80;
219 seqnum = *((uint16_t *)e + 1);
221 switch (e->response_type) {
223 DLOG("Error %s on seqnum %d (%s).\n",
224 labelError[*((uint8_t *)e + 1)],
226 labelRequest[*((uint8_t *)e + 10)]);
229 if (e->response_type > sizeof(labelEvent) / sizeof(char *))
231 DLOG("Event %s following seqnum %d%s.\n",
232 labelEvent[e->response_type],
234 labelSendEvent[sendEvent]);
236 case XCB_KEYMAP_NOTIFY:
237 DLOG("Event %s%s.\n",
238 labelEvent[e->response_type],
239 labelSendEvent[sendEvent]);