diff --git a/client.c b/client.c index 8ec58aa24..01eec280b 100644 --- a/client.c +++ b/client.c @@ -409,17 +409,13 @@ client_focus_update(client_t *c) /* Already focused */ return; } - luaA_object_push(globalconf.L, c); - client_set_minimized(globalconf.L, -1, false); - - /* unban the client before focusing for consistency */ - client_unban(c); globalconf.screen_focus = &globalconf.screens.tab[c->phys_screen]; globalconf.screen_focus->prev_client_focus = c; globalconf.screen_focus->client_focus = c; /* according to EWMH, we have to remove the urgent state from a client */ + luaA_object_push(globalconf.L, c); client_set_urgent(globalconf.L, -1, false); ewmh_update_net_active_window(c->phys_screen); @@ -447,6 +443,9 @@ client_focus(client_t *c) if(!client_maybevisible(c, c->screen)) return; + /* X11 doesn't let you focus a window that isn't viewable */ + client_unban(c); + if (!c->nofocus) client_focus_update(c); @@ -1256,6 +1255,11 @@ client_unban(client_t *c) xcb_map_window(globalconf.connection, c->window); c->isbanned = false; + + /* An unbanned clients shouldn't be minimized */ + luaA_object_push(globalconf.L, c); + client_set_minimized(globalconf.L, -1, false); + lua_pop(globalconf.L, 1); } }