From c862bf0534c9f596879da624463fa23560782047 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Mon, 24 Aug 2009 11:11:52 +0200 Subject: [PATCH] property: use xcb_get_wm_protocols_from_reply Signed-off-by: Julien Danjou --- awesomeConfig.cmake | 2 +- client.c | 2 +- property.c | 26 +++++++++++++++++--------- property.h | 2 +- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/awesomeConfig.cmake b/awesomeConfig.cmake index 8f577a52..019cd5a7 100644 --- a/awesomeConfig.cmake +++ b/awesomeConfig.cmake @@ -144,7 +144,7 @@ pkg_check_modules(AWESOME_REQUIRED REQUIRED xcb-aux>=0.3.0 xcb-atom>=0.3.0 xcb-keysyms>=0.3.4 - xcb-icccm>=0.3.3 + xcb-icccm>=0.3.6 xcb-image>=0.3.0 xcb-property>=0.3.0 cairo-xcb diff --git a/client.c b/client.c index 67f41338..4619a83d 100644 --- a/client.c +++ b/client.c @@ -656,7 +656,7 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen, property_update_wm_name(c, NULL); property_update_wm_icon_name(c, NULL); property_update_wm_class(c, NULL); - property_update_wm_protocols(c); + property_update_wm_protocols(c, NULL); /* update strut */ ewmh_process_client_strut(c, NULL); diff --git a/property.c b/property.c index 7db4f89a..55f54091 100644 --- a/property.c +++ b/property.c @@ -391,19 +391,27 @@ property_handle_net_wm_pid(void *data, * \param c The client. */ void -property_update_wm_protocols(client_t *c) +property_update_wm_protocols(client_t *c, xcb_get_property_reply_t *reply) { xcb_get_wm_protocols_reply_t protocols; - /* If this fails for any reason, we still got the old value */ - if(xcb_get_wm_protocols_reply(globalconf.connection, - xcb_get_wm_protocols_unchecked(globalconf.connection, - c->window, WM_PROTOCOLS), - &protocols, NULL)) + if(reply) { - xcb_get_wm_protocols_reply_wipe(&c->protocols); - memcpy(&c->protocols, &protocols, sizeof(protocols)); + if(!xcb_get_wm_protocols_from_reply(reply, &protocols)) + return; } + else + { + /* If this fails for any reason, we still got the old value */ + if(!xcb_get_wm_protocols_reply(globalconf.connection, + xcb_get_wm_protocols_unchecked(globalconf.connection, + c->window, WM_PROTOCOLS), + &protocols, NULL)) + return; + } + + xcb_get_wm_protocols_reply_wipe(&c->protocols); + memcpy(&c->protocols, &protocols, sizeof(protocols)); } /** The property notify event handler. @@ -425,7 +433,7 @@ property_handle_wm_protocols(void *data, client_t *c = client_getbywin(window); if(c) - property_update_wm_protocols(c); + property_update_wm_protocols(c, reply); return 0; } diff --git a/property.h b/property.h index 1fe082b0..18215826 100644 --- a/property.h +++ b/property.h @@ -31,7 +31,7 @@ void property_update_wm_hints(client_t *, xcb_get_property_reply_t *); void property_update_wm_class(client_t *, xcb_get_property_reply_t *); void property_update_wm_name(client_t *, xcb_get_property_reply_t *); void property_update_wm_icon_name(client_t *, xcb_get_property_reply_t *); -void property_update_wm_protocols(client_t *); +void property_update_wm_protocols(client_t *, xcb_get_property_reply_t *); void property_update_wm_client_machine(client_t *, xcb_get_property_reply_t *); void property_update_wm_window_role(client_t *, xcb_get_property_reply_t *); void property_update_net_wm_pid(client_t *, xcb_get_property_reply_t *);