client_hasproto(): Use cached WM_PROTOCOLS

client_hasproto() now doesn't have to query the X server anymore.

This fixes FS#543.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Uli Schlachter 2009-06-24 18:17:31 +02:00 committed by Julien Danjou
parent 28b80648a8
commit 290cd49463
1 changed files with 4 additions and 13 deletions

View File

@ -209,20 +209,11 @@ bool
client_hasproto(client_t *c, xcb_atom_t atom)
{
uint32_t i;
xcb_get_wm_protocols_reply_t protocols;
bool ret = false;
if(xcb_get_wm_protocols_reply(globalconf.connection,
xcb_get_wm_protocols_unchecked(globalconf.connection,
c->win, WM_PROTOCOLS),
&protocols, NULL))
{
for(i = 0; !ret && i < protocols.atoms_len; i++)
if(protocols.atoms[i] == atom)
ret = true;
xcb_get_wm_protocols_reply_wipe(&protocols);
}
return ret;
for(i = 0; i < c->protocols.atoms_len; i++)
if(c->protocols.atoms[i] == atom)
return true;
return false;
}
/** Sets focus on window - using xcb_set_input_focus or WM_TAKE_FOCUS