4 /* Debug functions here, especially the FormatEvent-stuff, which prints unhandled events */
6 static const char *labelError[] = {
27 static const char *labelRequest[] = {
30 "ChangeWindowAttributes",
31 "GetWindowAttributes",
58 "ChangeActivePointerGrab",
108 "CopyColormapAndFree",
111 "ListInstalledColormaps",
128 "ChangeKeyboardMapping",
129 "GetKeyboardMapping",
130 "ChangeKeyboardControl",
131 "GetKeyboardControl",
133 "ChangePointerControl",
146 "SetModifierMapping",
147 "GetModifierMapping",
158 static const char *labelEvent[] = {
196 static const char *labelSendEvent[] = {
201 int format_event(xcb_generic_event_t *e) {
205 sendEvent = (e->response_type & 0x80) ? 1 : 0;
206 e->response_type &= ~0x80;
207 seqnum = *((uint16_t *) e + 1);
209 switch(e->response_type) {
211 printf("Error %s on seqnum %d (%s).\n",
212 labelError[*((uint8_t *) e + 1)],
214 labelRequest[*((uint8_t *) e + 10)]);
217 printf("Event %s following seqnum %d%s.\n",
218 labelEvent[e->response_type],
220 labelSendEvent[sendEvent]);
222 case XCB_KEYMAP_NOTIFY:
223 printf("Event %s%s.\n",
224 labelEvent[e->response_type],
225 labelSendEvent[sendEvent]);
233 int handle_event(void *ignored, xcb_connection_t *c, xcb_generic_event_t *e) {
234 return format_event(e);