property: split _NET_WM_{ICON_,}NAME from WM_{ICON_,}NAME

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-08-25 16:39:10 +02:00
parent fb9aefa85a
commit 1337129191
4 changed files with 47 additions and 5 deletions

View File

@ -56,7 +56,9 @@ luaA_client_gc(lua_State *L)
p_delete(&c->class);
p_delete(&c->instance);
p_delete(&c->icon_name);
p_delete(&c->alt_icon_name);
p_delete(&c->name);
p_delete(&c->alt_name);
return luaA_object_gc(L);
}
@ -158,6 +160,16 @@ client_set_icon_name(lua_State *L, int cidx, char *icon_name)
hook_property(c, "icon_name");
}
void
client_set_alt_icon_name(lua_State *L, int cidx, char *icon_name)
{
client_t *c = luaA_client_checkudata(L, cidx);
p_delete(&c->alt_icon_name);
c->alt_icon_name = icon_name;
luaA_object_emit_signal(L, cidx, "property::icon_name", 0);
hook_property(c, "icon_name");
}
void
client_set_role(lua_State *L, int cidx, char *role)
{
@ -210,6 +222,16 @@ client_set_name(lua_State *L, int cidx, char *name)
luaA_object_emit_signal(L, cidx, "property::name", 0);
}
void
client_set_alt_name(lua_State *L, int cidx, char *name)
{
client_t *c = luaA_client_checkudata(L, cidx);
p_delete(&c->alt_name);
c->alt_name = name;
hook_property(c, "name");
luaA_object_emit_signal(L, cidx, "property::name", 0);
}
/** Returns true if a client is tagged
* with one of the tags of the specified screen.
* \param c The client to check.
@ -653,7 +675,9 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen,
/* update window title */
property_update_wm_name(c, NULL);
property_update_net_wm_name(c, NULL);
property_update_wm_icon_name(c, NULL);
property_update_net_wm_icon_name(c, NULL);
property_update_wm_class(c, NULL);
property_update_wm_protocols(c, NULL);
@ -1772,8 +1796,20 @@ luaA_client_set_skip_taskbar(lua_State *L, client_t *c)
return 0;
}
LUA_OBJECT_EXPORT_PROPERTY(client, client_t, name, lua_pushstring)
LUA_OBJECT_EXPORT_PROPERTY(client, client_t, icon_name, lua_pushstring)
static int
luaA_client_get_name(lua_State *L, client_t *c)
{
lua_pushstring(L, c->name ? c->name : c->alt_name);
return 1;
}
static int
luaA_client_get_icon_name(lua_State *L, client_t *c)
{
lua_pushstring(L, c->icon_name ? c->icon_name : c->alt_icon_name);
return 1;
}
LUA_OBJECT_EXPORT_PROPERTY(client, client_t, class, lua_pushstring)
LUA_OBJECT_EXPORT_PROPERTY(client, client_t, instance, lua_pushstring)
LUA_OBJECT_EXPORT_PROPERTY(client, client_t, machine, lua_pushstring)

View File

@ -63,7 +63,7 @@ struct client_t
/** Valid, or not ? */
bool invalid;
/** Client name */
char *name, *icon_name;
char *name, *alt_name, *icon_name, *alt_icon_name;
/** WM_CLASS stuff */
char *class, *instance;
/** Window geometry */
@ -189,10 +189,12 @@ void client_set_pid(lua_State *, int, uint32_t);
void client_set_role(lua_State *, int, char *);
void client_set_machine(lua_State *, int, char *);
void client_set_icon_name(lua_State *, int, char *);
void client_set_alt_icon_name(lua_State *, int, char *);
void client_set_class_instance(lua_State *, int, const char *, const char *);
void client_set_type(lua_State *L, int, window_type_t);
void client_set_transient_for(lua_State *L, int, client_t *);
void client_set_name(lua_State *L, int, char *);
void client_set_alt_name(lua_State *L, int, char *);
void client_set_group_window(lua_State *, int, xcb_window_t);
void client_set_icon(lua_State *, int, int);
void client_set_skip_taskbar(lua_State *, int, bool);

View File

@ -66,7 +66,9 @@
HANDLE_TEXT_PROPERTY(wm_name, WM_NAME, client_set_name)
HANDLE_TEXT_PROPERTY(net_wm_name, _NET_WM_NAME, client_set_name)
HANDLE_TEXT_PROPERTY(wm_icon_name, WM_ICON_NAME, client_set_icon_name)
HANDLE_TEXT_PROPERTY(net_wm_icon_name, _NET_WM_ICON_NAME, client_set_icon_name)
HANDLE_TEXT_PROPERTY(wm_client_machine, WM_CLIENT_MACHINE, client_set_machine)
HANDLE_TEXT_PROPERTY(wm_window_role, WM_WINDOW_ROLE, client_set_role)
@ -437,9 +439,9 @@ void a_xcb_set_property_handlers(void)
/* EWMH stuff */
xcb_property_set_handler(&globalconf.prophs, _NET_WM_NAME, UINT_MAX,
property_handle_wm_name, NULL);
property_handle_net_wm_name, NULL);
xcb_property_set_handler(&globalconf.prophs, _NET_WM_ICON_NAME, UINT_MAX,
property_handle_wm_icon_name, NULL);
property_handle_net_wm_icon_name, NULL);
xcb_property_set_handler(&globalconf.prophs, _NET_WM_STRUT_PARTIAL, UINT_MAX,
property_handle_net_wm_strut_partial, NULL);
xcb_property_set_handler(&globalconf.prophs, _NET_WM_ICON, UINT_MAX,

View File

@ -30,7 +30,9 @@ 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_class(client_t *, xcb_get_property_reply_t *);
void property_update_wm_name(client_t *, xcb_get_property_reply_t *);
void property_update_net_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_net_wm_icon_name(client_t *, xcb_get_property_reply_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 *);