_con_move_to_con: focus_next only if in different workspaces

next
Orestis Floros 2019-10-14 15:38:44 +03:00
parent 5f54971425
commit 2821270949
No known key found for this signature in database
GPG Key ID: A09DBD7D3222C1C3
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;