From 290cd49463eb81d42070bc3845a3dc84b004b967 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Wed, 24 Jun 2009 18:17:31 +0200 Subject: [PATCH] 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 Signed-off-by: Julien Danjou --- client.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/client.c b/client.c index 4ba84dc03..ae63f9072 100644 --- a/client.c +++ b/client.c @@ -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