Handle _NET_WM_DESKTOP more intelligently

This makes sure that an invalid value for this property doesn't cause the client
to have no tag at all. This should be especially useful when one uses dynamic
tags and restarts awesome which causes less tags to exist than before.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Uli Schlachter 2010-06-13 09:03:31 +02:00 committed by Julien Danjou
parent 65dfdf01ce
commit e291c03982
1 changed files with 8 additions and 1 deletions

9
ewmh.c
View File

@ -529,7 +529,7 @@ ewmh_client_check_hints(client_t *c)
desktop = *(uint32_t *) data;
if(desktop == -1)
c->sticky = true;
else
else if (desktop >= 0 && desktop < tags->len)
for(int i = 0; i < tags->len; i++)
if(desktop == i)
{
@ -538,6 +538,13 @@ ewmh_client_check_hints(client_t *c)
}
else
untag_client(c, tags->tab[i]);
else
/* Value out of bounds, just give it the first tag */
if (tags->len > 0)
{
luaA_object_push(globalconf.L, tags->tab[0]);
tag_client(c);
}
}
p_delete(&reply);