client: store WM_CLIENT_MACHINE

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-08-10 11:36:11 +02:00
parent f93c91cd1b
commit 0acb4aeff4
4 changed files with 38 additions and 7 deletions

View File

@ -548,6 +548,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);
/* Then check clients hints */ /* Then check clients hints */
ewmh_client_check_hints(c); ewmh_client_check_hints(c);
@ -1731,11 +1732,7 @@ luaA_client_index(lua_State *L)
lua_pushnumber(L, c->leader_win); lua_pushnumber(L, c->leader_win);
break; break;
case A_TK_MACHINE: case A_TK_MACHINE:
if(!xutil_text_prop_get(globalconf.connection, c->win, lua_pushstring(L, c->machine);
WM_CLIENT_MACHINE, &value, &slen))
return 0;
lua_pushlstring(L, value, slen);
p_delete(&value);
break; break;
case A_TK_ICON_NAME: case A_TK_ICON_NAME:
lua_pushstring(L, c->icon_name); lua_pushstring(L, c->icon_name);

View File

@ -148,6 +148,8 @@ struct client_t
/** Size hints */ /** Size hints */
xcb_size_hints_t size_hints; xcb_size_hints_t size_hints;
bool size_hints_honor; bool size_hints_honor;
/** Machine the client is running on. */
char *machine;
/** Window it is transient for */ /** Window it is transient for */
client_t *transient_for; client_t *transient_for;
}; };

View File

@ -1,7 +1,7 @@
/* /*
* property.c - property handlers * property.c - property handlers
* *
* Copyright © 2008 Julien Danjou <julien@danjou.info> * Copyright © 2008-2009 Julien Danjou <julien@danjou.info>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -70,6 +70,35 @@ property_handle_wm_transient_for(void *data,
return 0; return 0;
} }
void
property_update_wm_client_machine(client_t *c)
{
ssize_t slen;
char *value;
if(!xutil_text_prop_get(globalconf.connection, c->win,
WM_CLIENT_MACHINE, &value, &slen))
return;
p_delete(&c->machine);
c->machine = a_strdup(value);
}
static int
property_handle_wm_client_machine(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_client_machine(c);
return 0;
}
/** Update leader hint of a client. /** Update leader hint of a client.
* \param c The client. * \param c The client.
@ -498,6 +527,8 @@ void a_xcb_set_property_handlers(void)
property_handle_wm_class, NULL); property_handle_wm_class, NULL);
xcb_property_set_handler(&globalconf.prophs, WM_PROTOCOLS, UINT_MAX, xcb_property_set_handler(&globalconf.prophs, WM_PROTOCOLS, UINT_MAX,
property_handle_wm_protocols, NULL); property_handle_wm_protocols, NULL);
xcb_property_set_handler(&globalconf.prophs, WM_CLIENT_MACHINE, UINT_MAX,
property_handle_wm_client_machine, NULL);
/* EWMH stuff */ /* EWMH stuff */
xcb_property_set_handler(&globalconf.prophs, _NET_WM_NAME, UINT_MAX, xcb_property_set_handler(&globalconf.prophs, _NET_WM_NAME, UINT_MAX,

View File

@ -1,7 +1,7 @@
/* /*
* property.h - property handlers header * property.h - property handlers header
* *
* Copyright © 2008 Julien Danjou <julien@danjou.info> * Copyright © 2008-2009 Julien Danjou <julien@danjou.info>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -32,6 +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 a_xcb_set_property_handlers(void); void a_xcb_set_property_handlers(void);
#endif #endif