Merge pull request #2975 from orestisf1993/move-con_focus

Fix move's focus bugs
This commit is contained in:
Michael Stapelberg
2018-03-16 09:31:53 +01:00
committed by GitHub
3 changed files with 156 additions and 7 deletions

View File

@ -332,6 +332,34 @@ for ($type = 1; $type <= 2; $type++) {
ok(!$source_ws->{urgent}, 'Source workspace is no longer marked urgent');
is($target_ws->{urgent}, 1, 'Target workspace is now marked urgent');
##############################################################################
# Test that moving an unfocused container doesn't reset its urgency hint.
##############################################################################
$tmp = fresh_workspace;
$win1 = open_window;
$win2 = open_window;
cmd 'split v';
$win3 = open_window;
set_urgency($win1, 1, $type);
sync_with_i3;
my $win1_info;
@content = @{get_ws_content($tmp)};
$win1_info = first { $_->{window} == $win1->id } @content;
ok($win1_info->{urgent}, 'win1 window is marked urgent');
cmd '[id="' . $win1->id . '"] move right';
cmd '[id="' . $win1->id . '"] move right';
@content = @{get_ws_content($tmp)};
$win1_info = first { $_->{window} == $win1->id } @content;
ok($win1_info->{urgent}, 'win1 window is still marked urgent after moving');
cmd '[id="' . $win1->id . '"] focus';
@content = @{get_ws_content($tmp)};
$win1_info = first { $_->{window} == $win1->id } @content;
ok(!$win1_info->{urgent}, 'win1 window is not marked urgent after focusing');
##############################################################################
exit_gracefully($pid);

View File

@ -106,4 +106,20 @@ $windows[0] = open_window;
cmd 'move left';
confirm_focus('split-v + move');
######################################################################
# Test that moving an unfocused container maintains the correct focus
# order.
# Layout: H [ A V1 [ B C D ] ]
######################################################################
fresh_workspace;
$windows[3] = open_window;
$windows[2] = open_window;
cmd 'split v';
$windows[1] = open_window;
$windows[0] = open_window;
cmd '[id=' . $windows[3]->id . '] move right';
confirm_focus('split-v + unfocused move');
done_testing;