property: use provided reply to get machine
This avoid a roundtrip when getting a property change event. Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
0649e079b5
commit
a6c0d9398e
2
client.c
2
client.c
|
@ -629,7 +629,7 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen,
|
||||||
property_update_wm_hints(c, NULL);
|
property_update_wm_hints(c, NULL);
|
||||||
property_update_wm_transient_for(c, NULL);
|
property_update_wm_transient_for(c, NULL);
|
||||||
property_update_wm_client_leader(c, NULL);
|
property_update_wm_client_leader(c, NULL);
|
||||||
property_update_wm_client_machine(c);
|
property_update_wm_client_machine(c, NULL);
|
||||||
property_update_wm_window_role(c);
|
property_update_wm_window_role(c);
|
||||||
property_update_net_wm_pid(c, NULL);
|
property_update_net_wm_pid(c, NULL);
|
||||||
property_update_net_wm_icon(c, NULL);
|
property_update_net_wm_icon(c, NULL);
|
||||||
|
|
23
property.c
23
property.c
|
@ -74,19 +74,26 @@ property_handle_wm_transient_for(void *data,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
property_update_wm_client_machine(client_t *c)
|
property_update_wm_client_machine(client_t *c, xcb_get_property_reply_t *reply)
|
||||||
{
|
{
|
||||||
ssize_t slen;
|
bool no_reply = !reply;
|
||||||
char *value;
|
|
||||||
|
|
||||||
if(!xutil_text_prop_get(globalconf.connection, c->window,
|
if(no_reply)
|
||||||
WM_CLIENT_MACHINE, &value, &slen))
|
reply = xcb_get_property_reply(globalconf.connection,
|
||||||
return;
|
xcb_get_any_property(globalconf.connection,
|
||||||
|
false,
|
||||||
|
c->window,
|
||||||
|
WM_CLIENT_MACHINE,
|
||||||
|
UINT_MAX), NULL);
|
||||||
|
|
||||||
|
const char *value = xutil_get_text_property_from_reply(reply);
|
||||||
|
|
||||||
luaA_object_push(globalconf.L, c);
|
luaA_object_push(globalconf.L, c);
|
||||||
client_set_machine(globalconf.L, -1, value);
|
client_set_machine(globalconf.L, -1, value);
|
||||||
p_delete(&value);
|
|
||||||
lua_pop(globalconf.L, 1);
|
lua_pop(globalconf.L, 1);
|
||||||
|
|
||||||
|
if(no_reply)
|
||||||
|
p_delete(&reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -100,7 +107,7 @@ property_handle_wm_client_machine(void *data,
|
||||||
client_t *c = client_getbywin(window);
|
client_t *c = client_getbywin(window);
|
||||||
|
|
||||||
if(c)
|
if(c)
|
||||||
property_update_wm_client_machine(c);
|
property_update_wm_client_machine(c, reply);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ 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 property_update_wm_protocols(client_t *);
|
void property_update_wm_protocols(client_t *);
|
||||||
void property_update_wm_client_machine(client_t *);
|
void property_update_wm_client_machine(client_t *, xcb_get_property_reply_t *);
|
||||||
void property_update_wm_window_role(client_t *);
|
void property_update_wm_window_role(client_t *);
|
||||||
void property_update_net_wm_pid(client_t *, xcb_get_property_reply_t *);
|
void property_update_net_wm_pid(client_t *, xcb_get_property_reply_t *);
|
||||||
void property_update_net_wm_icon(client_t *, xcb_get_property_reply_t *);
|
void property_update_net_wm_icon(client_t *, xcb_get_property_reply_t *);
|
||||||
|
|
Loading…
Reference in New Issue