client: store WM_WINDOW_ROLE
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
9394e9a852
commit
ab361ffe85
9
client.c
9
client.c
|
@ -549,6 +549,7 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen,
|
|||
property_update_wm_transient_for(c, NULL);
|
||||
property_update_wm_client_leader(c, NULL);
|
||||
property_update_wm_client_machine(c);
|
||||
property_update_wm_window_role(c);
|
||||
property_update_net_wm_pid(c, NULL);
|
||||
|
||||
/* Then check clients hints */
|
||||
|
@ -1630,10 +1631,8 @@ static int
|
|||
luaA_client_index(lua_State *L)
|
||||
{
|
||||
size_t len;
|
||||
ssize_t slen;
|
||||
client_t *c = luaA_client_checkudata(L, 1);
|
||||
const char *buf = luaL_checklstring(L, 2, &len);
|
||||
char *value;
|
||||
double d;
|
||||
|
||||
if(luaA_usemetatable(L, 1, 2))
|
||||
|
@ -1705,11 +1704,7 @@ luaA_client_index(lua_State *L)
|
|||
lua_pushstring(L, c->instance);
|
||||
break;
|
||||
case A_TK_ROLE:
|
||||
if(!xutil_text_prop_get(globalconf.connection, c->win,
|
||||
WM_WINDOW_ROLE, &value, &slen))
|
||||
return 0;
|
||||
lua_pushlstring(L, value, slen);
|
||||
p_delete(&value);
|
||||
lua_pushstring(L, c->role);
|
||||
break;
|
||||
case A_TK_PID:
|
||||
lua_pushnumber(L, c->pid);
|
||||
|
|
2
client.h
2
client.h
|
@ -150,6 +150,8 @@ struct client_t
|
|||
bool size_hints_honor;
|
||||
/** Machine the client is running on. */
|
||||
char *machine;
|
||||
/** Role of the client */
|
||||
char *role;
|
||||
/** Client pid */
|
||||
uint32_t pid;
|
||||
/** Window it is transient for */
|
||||
|
|
32
property.c
32
property.c
|
@ -100,6 +100,36 @@ property_handle_wm_client_machine(void *data,
|
|||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
property_update_wm_window_role(client_t *c)
|
||||
{
|
||||
ssize_t slen;
|
||||
char *value;
|
||||
|
||||
if(!xutil_text_prop_get(globalconf.connection, c->win,
|
||||
WM_WINDOW_ROLE, &value, &slen))
|
||||
return;
|
||||
|
||||
p_delete(&c->role);
|
||||
c->role = a_strdup(value);
|
||||
}
|
||||
|
||||
static int
|
||||
property_handle_wm_window_role(void *data,
|
||||
xcb_connection_t *connection,
|
||||
uint8_t state,
|
||||
xcb_window_t window,
|
||||
xcb_atom_t name,
|
||||
xcb_get_property_reply_t *reply)
|
||||
{
|
||||
client_t *c = client_getbywin(window);
|
||||
|
||||
if(c)
|
||||
property_update_wm_window_role(c);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Update leader hint of a client.
|
||||
* \param c The client.
|
||||
* \param reply (Optional) An existing reply.
|
||||
|
@ -569,6 +599,8 @@ void a_xcb_set_property_handlers(void)
|
|||
property_handle_wm_protocols, NULL);
|
||||
xcb_property_set_handler(&globalconf.prophs, WM_CLIENT_MACHINE, UINT_MAX,
|
||||
property_handle_wm_client_machine, NULL);
|
||||
xcb_property_set_handler(&globalconf.prophs, WM_WINDOW_ROLE, UINT_MAX,
|
||||
property_handle_wm_window_role, NULL);
|
||||
|
||||
/* EWMH stuff */
|
||||
xcb_property_set_handler(&globalconf.prophs, _NET_WM_NAME, UINT_MAX,
|
||||
|
|
|
@ -33,6 +33,7 @@ void property_update_wm_name(client_t *);
|
|||
void property_update_wm_icon_name(client_t *);
|
||||
void property_update_wm_protocols(client_t *);
|
||||
void property_update_wm_client_machine(client_t *);
|
||||
void property_update_wm_window_role(client_t *);
|
||||
void property_update_net_wm_pid(client_t *, xcb_get_property_reply_t *);
|
||||
void a_xcb_set_property_handlers(void);
|
||||
|
||||
|
|
Loading…
Reference in New Issue