Use con_descend_focused for workspaces in _tree_next
This way, when changing focus between outputs, the directional focus command will focus the focused window within the parent container that is next in the given direction. Previously, the next window of the given direction was focused which is Inconsistent with changing focus inside the same output. Fixes #1160.
This commit is contained in:
@ -92,7 +92,7 @@ reset_focus $s3_ws;
|
||||
|
||||
cmd "workspace $s2_ws";
|
||||
cmd 'focus right';
|
||||
is($x->input_focus, $sixth->id, 'sixth window focused');
|
||||
is($x->input_focus, $seventh->id, 'seventh window focused');
|
||||
reset_focus $s3_ws;
|
||||
|
||||
cmd "workspace $s2_ws";
|
||||
@ -110,6 +110,8 @@ is($x->input_focus, $third->id, 'third window focused');
|
||||
cmd 'focus parent';
|
||||
cmd 'focus parent';
|
||||
cmd 'split v';
|
||||
# Focus second or else $first gets to the top of the focus stack.
|
||||
cmd '[id=' . $second->id . '] focus';
|
||||
reset_focus $s0_ws;
|
||||
|
||||
cmd "workspace $s3_ws";
|
||||
@ -137,4 +139,96 @@ cmd "workspace $s2_ws";
|
||||
cmd 'focus up';
|
||||
is($x->input_focus, $second->id, 'second window focused');
|
||||
|
||||
###################################################################
|
||||
# Test that focus (left|down|right|up), when focusing across
|
||||
# outputs, doesn't focus the next window in the given direction but
|
||||
# the most focused window of the container in the given direction.
|
||||
# In the following layout:
|
||||
# [ WS1*[ ] WS2[ H[ A B* ] ] ]
|
||||
# (where the asterisk denotes the focused container within its
|
||||
# parent) moving right from WS1 should focus B which is focused
|
||||
# inside WS2, not A which is the next window on the right of WS1.
|
||||
# See issue #1160.
|
||||
###################################################################
|
||||
|
||||
kill_all_windows;
|
||||
|
||||
sync_with_i3;
|
||||
$x->root->warp_pointer(1025, 0); # Second screen.
|
||||
sync_with_i3;
|
||||
$s1_ws = fresh_workspace;
|
||||
$first = open_window;
|
||||
$second = open_window;
|
||||
|
||||
sync_with_i3;
|
||||
$x->root->warp_pointer(0, 0); # First screen.
|
||||
sync_with_i3;
|
||||
$s0_ws = fresh_workspace;
|
||||
open_window;
|
||||
$third = open_window;
|
||||
|
||||
cmd 'focus right';
|
||||
is($x->input_focus, $second->id, 'second window (rightmost) focused');
|
||||
cmd 'focus left';
|
||||
is($x->input_focus, $first->id, 'first window focused');
|
||||
cmd 'focus left';
|
||||
is($x->input_focus, $third->id, 'third window focused');
|
||||
|
||||
|
||||
###################################################################
|
||||
# Similar but with a tabbed layout.
|
||||
###################################################################
|
||||
|
||||
cmd 'layout tabbed';
|
||||
$fourth = open_window;
|
||||
cmd 'focus left';
|
||||
is($x->input_focus, $third->id, 'third window (tabbed) focused');
|
||||
cmd "workspace $s1_ws";
|
||||
cmd 'focus left';
|
||||
is($x->input_focus, $third->id, 'third window (tabbed) focused');
|
||||
|
||||
|
||||
###################################################################
|
||||
# Similar but with a stacked layout on the bottom screen.
|
||||
###################################################################
|
||||
|
||||
sync_with_i3;
|
||||
$x->root->warp_pointer(0, 769); # Third screen.
|
||||
sync_with_i3;
|
||||
$s2_ws = fresh_workspace;
|
||||
cmd 'layout stacked';
|
||||
$fifth = open_window;
|
||||
$sixth = open_window;
|
||||
|
||||
cmd "workspace $s0_ws";
|
||||
cmd 'focus down';
|
||||
is($x->input_focus, $sixth->id, 'sixth window (stacked) focused');
|
||||
|
||||
###################################################################
|
||||
# Similar but with a more complex layout.
|
||||
###################################################################
|
||||
|
||||
sync_with_i3;
|
||||
$x->root->warp_pointer(1025, 769); # Fourth screen.
|
||||
sync_with_i3;
|
||||
$s3_ws = fresh_workspace;
|
||||
open_window;
|
||||
open_window;
|
||||
cmd 'split v';
|
||||
open_window;
|
||||
open_window;
|
||||
cmd 'split h';
|
||||
my $nested = open_window;
|
||||
open_window;
|
||||
cmd 'focus left';
|
||||
is($x->input_focus, $nested->id, 'nested window focused');
|
||||
|
||||
cmd "workspace $s1_ws";
|
||||
cmd 'focus down';
|
||||
is($x->input_focus, $nested->id, 'nested window focused from workspace above');
|
||||
|
||||
cmd "workspace $s2_ws";
|
||||
cmd 'focus right';
|
||||
is($x->input_focus, $nested->id, 'nested window focused from workspace on the left');
|
||||
|
||||
done_testing;
|
||||
|
Reference in New Issue
Block a user