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;
/* 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)

View File

@ -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);
}
}
}

View File

@ -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");

View File

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