Focus cons when moving to a visible workspace on a different output (Thanks mseed)

Fixes: #355
This commit is contained in:
Michael Stapelberg 2011-03-20 19:32:00 +01:00
parent 67b37551d8
commit 99ce340fea
1 changed files with 12 additions and 2 deletions

View File

@ -527,6 +527,9 @@ void con_move_to_workspace(Con *con, Con *workspace) {
con = con->parent; con = con->parent;
} }
Con *source_output = con_get_output(con),
*dest_output = con_get_output(workspace);
/* 1: save the container which is going to be focused after the current /* 1: save the container which is going to be focused after the current
* container is moved away */ * container is moved away */
Con *focus_next = con_next_focused(con); Con *focus_next = con_next_focused(con);
@ -562,8 +565,15 @@ void con_move_to_workspace(Con *con, Con *workspace) {
* calling tree_render(), so for the "real" focus this is a no-op) */ * calling tree_render(), so for the "real" focus this is a no-op) */
con_focus(con); con_focus(con);
/* 8: keep focus on the current workspace */ /* 8: when moving to a visible workspace on a different output, we keep the
con_focus(focus_next); * con focused. Otherwise, we leave the focus on the current workspace as we
* dont want to focus invisible workspaces */
if (source_output != dest_output &&
workspace_is_visible(workspace)) {
DLOG("Moved to a different output, focusing target");
} else {
con_focus(focus_next);
}
CALL(parent, on_remove_child); CALL(parent, on_remove_child);
} }