4 * i3 - an improved dynamic tiling window manager
6 * © 2009 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.
17 static const char *labelError[] = {
38 static const char *labelRequest[] = {
41 "ChangeWindowAttributes",
42 "GetWindowAttributes",
69 "ChangeActivePointerGrab",
119 "CopyColormapAndFree",
122 "ListInstalledColormaps",
139 "ChangeKeyboardMapping",
140 "GetKeyboardMapping",
141 "ChangeKeyboardControl",
142 "GetKeyboardControl",
144 "ChangePointerControl",
157 "SetModifierMapping",
158 "GetModifierMapping",
169 static const char *labelEvent[] = {
207 static const char *labelSendEvent[] = {
212 int format_event(xcb_generic_event_t *e) {
216 sendEvent = (e->response_type & 0x80) ? 1 : 0;
217 e->response_type &= ~0x80;
218 seqnum = *((uint16_t *) e + 1);
220 switch(e->response_type) {
222 printf("Error %s on seqnum %d (%s).\n",
223 labelError[*((uint8_t *) e + 1)],
225 labelRequest[*((uint8_t *) e + 10)]);
228 printf("Event %s following seqnum %d%s.\n",
229 labelEvent[e->response_type],
231 labelSendEvent[sendEvent]);
233 case XCB_KEYMAP_NOTIFY:
234 printf("Event %s%s.\n",
235 labelEvent[e->response_type],
236 labelSendEvent[sendEvent]);
244 int handle_event(void *ignored, xcb_connection_t *c, xcb_generic_event_t *e) {
245 return format_event(e);