_con_move_to_con: don't change focus when moving to active workspace

Seems to be the intention, indicated by this comment (con.c:1307-1309):
    /* For split containers, we use the currently focused container within it.
     * This allows setting marks on, e.g., tabbed containers which will move
     * con to a new tab behind the focused tab. */

Related to #3085.
This commit is contained in:
Orestis Floros
2018-03-25 04:45:19 +03:00
parent 45be56be33
commit 6d983b5ee0
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