X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fdebug.c;h=2dcdb56a428ee4b8ba7df87824c2121c305d83a4;hb=6800524f2e1b0205972cf28bb08d5bfcf6f67dfc;hp=0d9066b365657a0b73279ba9b706ed0fe1eb2c79;hpb=fb4c851e2a72ea29f290dc9dbeda723707a2961c;p=i3%2Fi3 diff --git a/src/debug.c b/src/debug.c index 0d9066b3..2dcdb56a 100644 --- a/src/debug.c +++ b/src/debug.c @@ -1,17 +1,19 @@ +#undef I3__FILE__ +#define I3__FILE__ "debug.c" /* - * vim:ts=8:expandtab + * vim:ts=4:sw=4:expandtab * * i3 - an improved dynamic tiling window manager + * © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE) * - * (c) 2009 Michael Stapelberg and contributors - * - * See file LICENSE for license information. + * debug.c: 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", @@ -218,19 +220,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; @@ -239,7 +243,3 @@ int format_event(xcb_generic_event_t *e) { fflush(stdout); return 1; } - -int handle_event(void *ignored, xcb_connection_t *c, xcb_generic_event_t *e) { - return format_event(e); -}