Bugfix: only restore focus if the workspace is focused, not if it is visible

This commit is contained in:
Michael Stapelberg 2010-03-23 14:43:35 +01:00
parent 42b638eac0
commit 56139f3656
1 changed files with 5 additions and 10 deletions

View File

@ -531,17 +531,12 @@ int handle_unmap_notify_event(void *data, xcb_connection_t *conn, xcb_unmap_noti
/* Lets see how many clients there are left on the workspace to delete it if its empty */ /* Lets see how many clients there are left on the workspace to delete it if its empty */
bool workspace_empty = SLIST_EMPTY(&(client->workspace->focus_stack)); bool workspace_empty = SLIST_EMPTY(&(client->workspace->focus_stack));
bool workspace_active = false; bool workspace_focused = (c_ws == client->workspace);
Client *to_focus = (!workspace_empty ? SLIST_FIRST(&(client->workspace->focus_stack)) : NULL); Client *to_focus = (!workspace_empty ? SLIST_FIRST(&(client->workspace->focus_stack)) : NULL);
/* If this workspace is currently active, we dont delete it */ /* If this workspace is currently visible, we dont delete it */
Output *screen; if (workspace_is_visible(client->workspace))
TAILQ_FOREACH(screen, &outputs, outputs)
if (screen->current_workspace == client->workspace) {
workspace_active = true;
workspace_empty = false; workspace_empty = false;
break;
}
if (workspace_empty) { if (workspace_empty) {
client->workspace->output = NULL; client->workspace->output = NULL;
@ -563,7 +558,7 @@ int handle_unmap_notify_event(void *data, xcb_connection_t *conn, xcb_unmap_noti
* the screen itself (if we do not focus the screen, it can happen that * the screen itself (if we do not focus the screen, it can happen that
* the focus is "nowhere" and thus keypress events will not be received * the focus is "nowhere" and thus keypress events will not be received
* by i3, thus the user cannot use any hotkeys). */ * by i3, thus the user cannot use any hotkeys). */
if (workspace_active) { if (workspace_focused) {
if (to_focus != NULL) if (to_focus != NULL)
set_focus(conn, to_focus, true); set_focus(conn, to_focus, true);
else { else {