Always unban a client that we are trying to focus

Previously, if a client had nofocus == true, it wasn't unminimized if sth tried
to focus it. Also, if this client had the WM_TAKE_FOCUS protocol, the focusing
would fail since it's an error to set the input focus to an unviewable window.

For consistency, this also moves the code that sets a client's minimized
property to false into client_unban() since it doesn't make sense to have a
minimized client unbanned (i.e. visible).

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2010-08-12 14:32:27 +02:00
parent 71ba321032
commit 47caab4580
1 changed files with 9 additions and 5 deletions

View File

@ -392,17 +392,13 @@ client_focus_update(client_t *c)
/* Already focused */ /* Already focused */
return; 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 = &globalconf.screens.tab[c->phys_screen];
globalconf.screen_focus->prev_client_focus = c; globalconf.screen_focus->prev_client_focus = c;
globalconf.screen_focus->client_focus = c; globalconf.screen_focus->client_focus = c;
/* according to EWMH, we have to remove the urgent state from a client */ /* 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); client_set_urgent(globalconf.L, -1, false);
luaA_class_emit_signal(globalconf.L, &client_class, "focus", 1); luaA_class_emit_signal(globalconf.L, &client_class, "focus", 1);
@ -421,6 +417,9 @@ client_focus(client_t *c)
if(!client_maybevisible(c, c->screen)) if(!client_maybevisible(c, c->screen))
return; return;
/* X11 doesn't let you focus a window that isn't viewable */
client_unban(c);
if (!c->nofocus) if (!c->nofocus)
client_focus_update(c); client_focus_update(c);
@ -1021,6 +1020,11 @@ client_unban(client_t *c)
xcb_map_window(globalconf.connection, c->frame_window); xcb_map_window(globalconf.connection, c->frame_window);
c->isbanned = false; 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);
} }
} }