Merge pull request #3200 from orestisf1993/_con_move_to_con

_con_move_to_con: don't change focus when moving to active workspace
This commit is contained in:
Ingo Bürk
2018-03-29 12:06:29 +02:00
committed by GitHub
3 changed files with 50 additions and 2 deletions

View File

@ -1209,12 +1209,19 @@ static bool _con_move_to_con(Con *con, Con *target, bool behind_focused, bool fi
/* We need to save the focused workspace on the output in case the
* new workspace is hidden and it's necessary to immediately switch
* back to the originally-focused workspace. */
Con *old_focus = TAILQ_FIRST(&(output_get_content(dest_output)->focus_head));
Con *old_focus_ws = TAILQ_FIRST(&(output_get_content(dest_output)->focus_head));
Con *old_focus = focused;
con_activate(con_descend_focused(con));
/* Restore focus if the output's focused workspace has changed. */
if (con_get_workspace(focused) != old_focus)
if (con_get_workspace(focused) != old_focus_ws) {
con_focus(old_focus);
}
/* Restore focus to the currently focused container. */
if (old_focus_ws == current_ws && old_focus->type != CT_WORKSPACE) {
con_activate(old_focus);
}
}
/* 7: when moving to another workspace, we leave the focus on the current

View File

@ -101,6 +101,12 @@ void output_push_sticky_windows(Con *to_focus) {
if (con_is_sticky(current)) {
bool ignore_focus = (to_focus == NULL) || (current != to_focus->parent);
con_move_to_workspace(current, visible_ws, true, false, ignore_focus);
if (!ignore_focus) {
Con *current_ws = con_get_workspace(focused);
con_activate(con_descend_focused(current));
/* Pushing sticky windows shouldn't change the focused workspace. */
con_activate(con_descend_focused(current_ws));
}
}
}
}