Use condition to get _WMFS_FUNCTIOn in event

This commit is contained in:
Martin Duquesnoy 2012-02-11 22:58:16 +01:00
parent 34964da69a
commit 966fdb2acf
4 changed files with 24 additions and 15 deletions

View File

@ -660,10 +660,10 @@ client_get_name(struct client *c)
unsigned long ir, il; unsigned long ir, il;
/* This one instead XFetchName for utf8 name support */ /* This one instead XFetchName for utf8 name support */
if(XGetWindowProperty(W->dpy, c->win, ATOM("_NET_WM_NAME"), 0, 4096, if(XGetWindowProperty(W->dpy, c->win, W->net_atom[net_wm_name], 0, 65536,
False, ATOM("UTF8_STRING"), &rt, &rf, &ir, &il, (unsigned char**)&c->title) != Success) False, W->net_atom[utf8_string], &rt, &rf, &ir, &il, (unsigned char**)&c->title) != Success)
XGetWindowProperty(W->dpy, c->win, ATOM("WM_NAME"), 0, 4096, XGetWindowProperty(W->dpy, c->win, W->net_atom[net_wm_name], 0, 65536,
False, ATOM("UTF8_STRING"), &rt, &rf, &ir, &il, (unsigned char**)&c->title); False, W->net_atom[utf8_string], &rt, &rf, &ir, &il, (unsigned char**)&c->title);
/* Still no title... */ /* Still no title... */
if(!c->title) if(!c->title)

View File

@ -110,23 +110,30 @@ event_clientmessageevent(XEvent *e)
if(type == wmfs_function || type == wmfs_cmd) if(type == wmfs_function || type == wmfs_cmd)
{ {
int d; int d;
long unsigned int len;
unsigned char *ret = NULL, *ret_cmd = NULL; unsigned char *ret = NULL, *ret_cmd = NULL;
void (*func)(Uicb); void (*func)(Uicb);
XGetWindowProperty(EVDPY(e), W->root, W->net_atom[wmfs_function], 0, 4096, if(XGetWindowProperty(EVDPY(e), W->root, W->net_atom[wmfs_function], 0, 65536,
False, W->net_atom[utf8_string], (Atom*)&d, &d, False, W->net_atom[utf8_string], (Atom*)&d, &d,
(long unsigned int*)&d, (long unsigned int*)&d, &ret); (long unsigned int*)&d, (long unsigned int*)&d, &ret) == Success
XGetWindowProperty(EVDPY(e), W->root, W->net_atom[wmfs_cmd], 0, 4096, && 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, False, W->net_atom[utf8_string], (Atom*)&d, &d,
(long unsigned int*)&d, (long unsigned int*)&d, &ret_cmd); &len, (long unsigned int*)&d, &ret_cmd) == Success
&& len && ret_cmd)
if((func = uicb_name_func((char*)ret))) {
func((Uicb)ret_cmd); func((Uicb)ret_cmd);
XFree(ret_cmd); XFree(ret_cmd);
}
else
func(NULL);
XFree(ret); XFree(ret);
} }
} }
}
if(type == net_active_window) if(type == net_active_window)
if((sy = systray_find(ev->data.l[0]))) if((sy = systray_find(ev->data.l[0])))

View File

@ -23,6 +23,7 @@ ewmh_init(void)
/* EWMH hints */ /* EWMH hints */
W->net_atom[wm_state] = ATOM("WM_STATE"); W->net_atom[wm_state] = ATOM("WM_STATE");
W->net_atom[wm_class] = ATOM("WM_CLASS"); 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_supported] = ATOM("_NET_SUPPORTED");
W->net_atom[net_client_list] = ATOM("_NET_CLIENT_LIST"); W->net_atom[net_client_list] = ATOM("_NET_CLIENT_LIST");
W->net_atom[net_frame_extents] = ATOM("_NET_FRAME_EXTENTS"); W->net_atom[net_frame_extents] = ATOM("_NET_FRAME_EXTENTS");

View File

@ -41,6 +41,7 @@ enum
/* ICCCM */ /* ICCCM */
wm_state, wm_state,
wm_class, wm_class,
wm_name,
/* EWMH */ /* EWMH */
net_supported, net_supported,
net_wm_name, net_wm_name,