From 43b39cfcf75ae7faccf36126d3b468260317d583 Mon Sep 17 00:00:00 2001 From: David Hill Date: Thu, 12 Jul 2012 17:19:22 -0400 Subject: [PATCH] make SWM_DEBUG compile again --- spectrwm.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/spectrwm.c b/spectrwm.c index 92576fe..543272e 100644 --- a/spectrwm.c +++ b/spectrwm.c @@ -136,7 +136,7 @@ static const char *buildstr = SPECTRWM_VERSION; #define xcb_icccm_get_wm_transient_for_reply xcb_get_wm_transient_for_reply #endif -/*#define SWM_DEBUG*/ +#define SWM_DEBUG #ifdef SWM_DEBUG #define DPRINTF(x...) do { if (swm_debug) fprintf(stderr, x); } while (0) #define DNPRINTF(n,x...) do { if (swm_debug & n) fprintf(stderr, x); } while (0) @@ -6600,7 +6600,7 @@ manage_window(xcb_window_t id) xcb_get_wm_class(conn, win->id), &win->ch, NULL)) { DNPRINTF(SWM_D_CLASS, "manage_window: class: %s, name: %s\n", - win->ch.class, win->ch.instance_name); + win->ch.class_name, win->ch.instance_name); /* java is retarded so treat it special */ if (strstr(win->ch.instance_name, "sun-awt")) { @@ -7132,15 +7132,28 @@ propertynotify(XEvent *e) struct ws_win *win; XPropertyEvent *ev = &e->xproperty; #ifdef SWM_DEBUG - xcb_get_atom_name_reply_t *r; + char *name; + size_t len; + xcb_get_atom_name_reply_t *r; r = xcb_get_atom_name_reply(conn, xcb_get_atom_name(conn, ev->atom), NULL); if (r) { - DNPRINTF(SWM_D_EVENT, - "propertynotify: window: 0x%x, atom: %s\n", - ev->window, ); + len = xcb_get_atom_name_name_length(r); + if (len > 0) { + name = malloc(len + 1); + if (name) { + memcpy(name, xcb_get_atom_name_name(r), len); + name[len] = '\0'; + + DNPRINTF(SWM_D_EVENT, + "propertynotify: window: 0x%lx, " + "atom: %s\n", + ev->window, name); + free(name); + } + } free(r); } #endif -- 1.7.10.4