X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fdebug.c;h=de47fca257299b32cfe95e00be7e148a4c7e209d;hb=3f45d3c44785c552b28f079df1888de52cd34a19;hp=cbdbd3683ddef979ecb40c100ec08b88c92b2b45;hpb=82dd64ff241b2dc376f44cea4e174a5face7c19d;p=i3%2Fi3 diff --git a/src/debug.c b/src/debug.c index cbdbd368..de47fca2 100644 --- a/src/debug.c +++ b/src/debug.c @@ -1,7 +1,20 @@ +/* + * vim:ts=8:expandtab + * + * i3 - an improved dynamic tiling window manager + * + * © 2009-2010 Michael Stapelberg and contributors + * + * See file LICENSE for license information. + * + * debug.c: Contains debugging functions, especially FormatEvent, which prints unhandled events. + * This code is from xcb-util. + * + */ #include #include -/* Debug functions here, especially the FormatEvent-stuff, which prints unhandled events */ +#include "log.h" static const char *labelError[] = { "Success", @@ -208,19 +221,21 @@ int format_event(xcb_generic_event_t *e) { switch(e->response_type) { case 0: - printf("Error %s on seqnum %d (%s).\n", + DLOG("Error %s on seqnum %d (%s).\n", labelError[*((uint8_t *) e + 1)], seqnum, labelRequest[*((uint8_t *) e + 10)]); break; default: - printf("Event %s following seqnum %d%s.\n", + if (e->response_type > sizeof(labelEvent) / sizeof(char*)) + break; + DLOG("Event %s following seqnum %d%s.\n", labelEvent[e->response_type], seqnum, labelSendEvent[sendEvent]); break; case XCB_KEYMAP_NOTIFY: - printf("Event %s%s.\n", + DLOG("Event %s%s.\n", labelEvent[e->response_type], labelSendEvent[sendEvent]); break;