ewmh: add support for _NET_WM_DESKTOP update

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-01-02 11:55:46 +01:00
parent 2e345fbcda
commit 17928bc112
3 changed files with 23 additions and 0 deletions

20
ewmh.c
View file

@ -446,6 +446,26 @@ ewmh_client_update_hints(client_t *c)
c->win, _NET_WM_STATE, ATOM, 32, i, state);
}
/** Update the client active desktop.
* This is "wrong" since it can be on several tags, but EWMH has a strict view
* of desktop system so just take the first tag.
* \param c The client.
*/
void
ewmh_client_update_desktop(client_t *c)
{
int i;
tag_array_t *tags = &globalconf.screens[c->screen].tags;
for(i = 0; i < tags->len; i++)
if(is_client_tagged(c, tags->tab[i]))
{
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
c->win, _NET_WM_DESKTOP, CARDINAL, 32, 1, &i);
return;
}
}
void
ewmh_client_check_hints(client_t *c)
{

1
ewmh.h
View file

@ -34,6 +34,7 @@ int ewmh_process_client_message(xcb_client_message_event_t *);
void ewmh_update_net_client_list_stacking(int);
void ewmh_client_check_hints(client_t *);
void ewmh_client_update_hints(client_t *);
void ewmh_client_update_desktop(client_t *);
void ewmh_update_workarea(int);
void ewmh_client_strut_update(client_t *, xcb_get_property_reply_t *);
xcb_get_property_cookie_t ewmh_window_icon_get_unchecked(xcb_window_t);

2
tag.c
View file

@ -144,6 +144,7 @@ tag_client(client_t *c, tag_t *t)
tag_ref(&t);
client_array_append(&t->clients, c);
client_saveprops_tags(c);
ewmh_client_update_desktop(c);
client_need_arrange(c);
/* call hook */
if(globalconf.hooks.tagged != LUA_REFNIL)
@ -167,6 +168,7 @@ untag_client(client_t *c, tag_t *t)
client_need_arrange(c);
client_array_take(&t->clients, i);
client_saveprops_tags(c);
ewmh_client_update_desktop(c);
/* call hook */
if(globalconf.hooks.tagged != LUA_REFNIL)
{