property: make use of xcb_get_wm_class_from_reply() when possible
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
b6db5137fc
commit
0b93186f09
2
client.c
2
client.c
|
@ -509,7 +509,7 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen,
|
||||||
/* update window title */
|
/* update window title */
|
||||||
property_update_wm_name(c);
|
property_update_wm_name(c);
|
||||||
property_update_wm_icon_name(c);
|
property_update_wm_icon_name(c);
|
||||||
property_update_wm_class(c);
|
property_update_wm_class(c, NULL);
|
||||||
|
|
||||||
xutil_text_prop_get(globalconf.connection, c->win, _NET_STARTUP_ID, &c->startup_id, NULL);
|
xutil_text_prop_get(globalconf.connection, c->win, _NET_STARTUP_ID, &c->startup_id, NULL);
|
||||||
|
|
||||||
|
|
26
property.c
26
property.c
|
@ -221,23 +221,35 @@ property_update_wm_name(client_t *c)
|
||||||
hooks_property(c, "name");
|
hooks_property(c, "name");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Update WM_CLASS of a client.
|
||||||
|
* \param c The client.
|
||||||
|
* \param reply The reply to get property request, or NULL if none.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
property_update_wm_class(client_t *c)
|
property_update_wm_class(client_t *c, xcb_get_property_reply_t *reply)
|
||||||
{
|
{
|
||||||
xcb_get_wm_class_reply_t hint;
|
xcb_get_wm_class_reply_t hint;
|
||||||
|
|
||||||
|
if(reply)
|
||||||
|
{
|
||||||
|
if(!xcb_get_wm_class_from_reply(&hint, reply))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(!xcb_get_wm_class_reply(globalconf.connection,
|
||||||
|
xcb_get_wm_class_unchecked(globalconf.connection, c->win),
|
||||||
|
&hint, NULL))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
p_delete(&c->instance);
|
p_delete(&c->instance);
|
||||||
p_delete(&c->class);
|
p_delete(&c->class);
|
||||||
|
|
||||||
if(xcb_get_wm_class_reply(globalconf.connection,
|
|
||||||
xcb_get_wm_class_unchecked(globalconf.connection, c->win),
|
|
||||||
&hint, NULL))
|
|
||||||
{
|
|
||||||
c->instance = a_strdup(hint.instance_name);
|
c->instance = a_strdup(hint.instance_name);
|
||||||
c->class = a_strdup(hint.class_name);
|
c->class = a_strdup(hint.class_name);
|
||||||
xcb_get_wm_class_reply_wipe(&hint);
|
xcb_get_wm_class_reply_wipe(&hint);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/** Update client icon name attribute with its new title.
|
/** Update client icon name attribute with its new title.
|
||||||
* \param c The client.
|
* \param c The client.
|
||||||
|
@ -304,7 +316,7 @@ property_handle_wm_class(void *data,
|
||||||
client_t *c = client_getbywin(window);
|
client_t *c = client_getbywin(window);
|
||||||
|
|
||||||
if(c)
|
if(c)
|
||||||
property_update_wm_class(c);
|
property_update_wm_class(c, reply);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,10 +25,10 @@
|
||||||
#include "structs.h"
|
#include "structs.h"
|
||||||
|
|
||||||
void property_update_wm_transient_for(client_t *, xcb_get_property_reply_t *);
|
void property_update_wm_transient_for(client_t *, xcb_get_property_reply_t *);
|
||||||
void property_update_wm_client_leader(client_t *c, xcb_get_property_reply_t *reply);
|
void property_update_wm_client_leader(client_t *c, xcb_get_property_reply_t *);
|
||||||
void property_update_wm_normal_hints(client_t *, xcb_get_property_reply_t *);
|
void property_update_wm_normal_hints(client_t *, xcb_get_property_reply_t *);
|
||||||
void property_update_wm_hints(client_t *, xcb_get_property_reply_t *);
|
void property_update_wm_hints(client_t *, xcb_get_property_reply_t *);
|
||||||
void property_update_wm_class(client_t *);
|
void property_update_wm_class(client_t *, xcb_get_property_reply_t *);
|
||||||
void property_update_wm_name(client_t *);
|
void property_update_wm_name(client_t *);
|
||||||
void property_update_wm_icon_name(client_t *);
|
void property_update_wm_icon_name(client_t *);
|
||||||
void a_xcb_set_property_handlers(void);
|
void a_xcb_set_property_handlers(void);
|
||||||
|
|
Loading…
Reference in New Issue