2 * vim:ts=4:sw=4:expandtab
4 * i3 - an improved dynamic tiling window manager
5 * © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE)
7 * debug.c: Debugging functions, especially FormatEvent, which prints unhandled
8 * events. This code is from xcb-util.
16 static const char *labelError[] = {
37 static const char *labelRequest[] = {
40 "ChangeWindowAttributes",
41 "GetWindowAttributes",
68 "ChangeActivePointerGrab",
118 "CopyColormapAndFree",
121 "ListInstalledColormaps",
138 "ChangeKeyboardMapping",
139 "GetKeyboardMapping",
140 "ChangeKeyboardControl",
141 "GetKeyboardControl",
143 "ChangePointerControl",
156 "SetModifierMapping",
157 "GetModifierMapping",
168 static const char *labelEvent[] = {
206 static const char *labelSendEvent[] = {
211 int format_event(xcb_generic_event_t *e) {
215 sendEvent = (e->response_type & 0x80) ? 1 : 0;
216 e->response_type &= ~0x80;
217 seqnum = *((uint16_t *) e + 1);
219 switch(e->response_type) {
221 DLOG("Error %s on seqnum %d (%s).\n",
222 labelError[*((uint8_t *) e + 1)],
224 labelRequest[*((uint8_t *) e + 10)]);
227 if (e->response_type > sizeof(labelEvent) / sizeof(char*))
229 DLOG("Event %s following seqnum %d%s.\n",
230 labelEvent[e->response_type],
232 labelSendEvent[sendEvent]);
234 case XCB_KEYMAP_NOTIFY:
235 DLOG("Event %s%s.\n",
236 labelEvent[e->response_type],
237 labelSendEvent[sendEvent]);