Merge pull request #3829 from orestisfl/move_to_mark_focus

_con_move_to_con: focus_next only if in different workspaces
This commit is contained in:
Ingo Bürk 2019-10-14 15:27:13 +02:00 committed by GitHub
commit a638e0408e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 1 deletions

View File

@ -1195,7 +1195,7 @@ static bool _con_move_to_con(Con *con, Con *target, bool behind_focused, bool fi
/* 1: save the container which is going to be focused after the current
* container is moved away */
Con *focus_next = NULL;
if (!ignore_focus && source_ws == current_ws) {
if (!ignore_focus && source_ws == current_ws && target_ws != source_ws) {
focus_next = con_descend_focused(source_ws);
if (focus_next == con || con_has_parent(focus_next, con)) {
focus_next = con_next_focused(con);

View File

@ -280,4 +280,33 @@ cmd '[id=' . $windows[0]->id . '] kill';
kill_and_confirm_focus($windows[2]->id, 'window 2 focused after tiling killed');
kill_and_confirm_focus($windows[3]->id, 'window 3 focused after tiling killed');
######################################################################
# cmp_tree tests
######################################################################
cmp_tree(
msg => 'Basic test',
layout_before => 'S[a b] V[c d T[e f g*]]',
layout_after => ' ',
cb => sub {
@windows = reverse @{$_[0]};
confirm_focus('focus order');
});
cmp_tree(
msg => 'Focused container that is moved to mark keeps focus',
layout_before => 'S[a b] V[2 3 T[4 5* 6]]',
layout_after => 'S[a b*]',
cb => sub {
cmd '[class=' . $_[0][3]->id . '] mark 3';
cmd 'move to mark 3';
$windows[0] = $_[0][5];
$windows[1] = $_[0][6];
$windows[2] = $_[0][4];
$windows[3] = $_[0][3];
$windows[4] = $_[0][2];
confirm_focus('focus order');
});
done_testing;