property: use xcb_get_wm_protocols_from_reply

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-08-24 11:11:52 +02:00
parent e829db1a41
commit c862bf0534
4 changed files with 20 additions and 12 deletions

View File

@ -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

View File

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

View File

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

View File

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