diff --git a/src/client.c b/src/client.c index f628ce6..4580d94 100644 --- a/src/client.c +++ b/src/client.c @@ -660,10 +660,10 @@ client_get_name(struct client *c) unsigned long ir, il; /* This one instead XFetchName for utf8 name support */ - if(XGetWindowProperty(W->dpy, c->win, ATOM("_NET_WM_NAME"), 0, 4096, - False, ATOM("UTF8_STRING"), &rt, &rf, &ir, &il, (unsigned char**)&c->title) != Success) - XGetWindowProperty(W->dpy, c->win, ATOM("WM_NAME"), 0, 4096, - False, ATOM("UTF8_STRING"), &rt, &rf, &ir, &il, (unsigned char**)&c->title); + if(XGetWindowProperty(W->dpy, c->win, W->net_atom[net_wm_name], 0, 65536, + False, W->net_atom[utf8_string], &rt, &rf, &ir, &il, (unsigned char**)&c->title) != Success) + XGetWindowProperty(W->dpy, c->win, W->net_atom[net_wm_name], 0, 65536, + False, W->net_atom[utf8_string], &rt, &rf, &ir, &il, (unsigned char**)&c->title); /* Still no title... */ if(!c->title) diff --git a/src/event.c b/src/event.c index d368c17..fe165e9 100644 --- a/src/event.c +++ b/src/event.c @@ -110,21 +110,28 @@ event_clientmessageevent(XEvent *e) if(type == wmfs_function || type == wmfs_cmd) { int d; + long unsigned int len; unsigned char *ret = NULL, *ret_cmd = NULL; void (*func)(Uicb); - XGetWindowProperty(EVDPY(e), W->root, W->net_atom[wmfs_function], 0, 4096, - False, W->net_atom[utf8_string], (Atom*)&d, &d, - (long unsigned int*)&d, (long unsigned int*)&d, &ret); - XGetWindowProperty(EVDPY(e), W->root, W->net_atom[wmfs_cmd], 0, 4096, - False, W->net_atom[utf8_string], (Atom*)&d, &d, - (long unsigned int*)&d, (long unsigned int*)&d, &ret_cmd); + if(XGetWindowProperty(EVDPY(e), W->root, W->net_atom[wmfs_function], 0, 65536, + False, W->net_atom[utf8_string], (Atom*)&d, &d, + (long unsigned int*)&d, (long unsigned int*)&d, &ret) == Success + && ret && ((func = uicb_name_func((char*)ret)))) + { + if(XGetWindowProperty(EVDPY(e), W->root, W->net_atom[wmfs_cmd], 0, 65536, + False, W->net_atom[utf8_string], (Atom*)&d, &d, + &len, (long unsigned int*)&d, &ret_cmd) == Success + && len && ret_cmd) + { + func((Uicb)ret_cmd); + XFree(ret_cmd); + } + else + func(NULL); - if((func = uicb_name_func((char*)ret))) - func((Uicb)ret_cmd); - - XFree(ret_cmd); - XFree(ret); + XFree(ret); + } } } diff --git a/src/ewmh.c b/src/ewmh.c index 4da6b48..af7d03b 100644 --- a/src/ewmh.c +++ b/src/ewmh.c @@ -23,6 +23,7 @@ ewmh_init(void) /* EWMH hints */ W->net_atom[wm_state] = ATOM("WM_STATE"); W->net_atom[wm_class] = ATOM("WM_CLASS"); + W->net_atom[wm_name] = ATOM("WM_NAME"); W->net_atom[net_supported] = ATOM("_NET_SUPPORTED"); W->net_atom[net_client_list] = ATOM("_NET_CLIENT_LIST"); W->net_atom[net_frame_extents] = ATOM("_NET_FRAME_EXTENTS"); diff --git a/src/ewmh.h b/src/ewmh.h index 5540979..111b3b8 100644 --- a/src/ewmh.h +++ b/src/ewmh.h @@ -41,6 +41,7 @@ enum /* ICCCM */ wm_state, wm_class, + wm_name, /* EWMH */ net_supported, net_wm_name,