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