From e291c03982018fd2a09be460d93459489d964221 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 13 Jun 2010 09:03:31 +0200 Subject: [PATCH] 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 Signed-off-by: Julien Danjou --- ewmh.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ewmh.c b/ewmh.c index 8c121f94..0de106a0 100644 --- a/ewmh.c +++ b/ewmh.c @@ -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);