Prevent moving out of fullscreen containers.
This commit is contained in:
parent
8bf4e9e059
commit
4452bfb942
|
@ -169,6 +169,12 @@ void tree_move(int direction) {
|
|||
while (above->parent != same_orientation)
|
||||
above = above->parent;
|
||||
|
||||
/* Enforce the fullscreen focus restrictions. */
|
||||
if (!con_fullscreen_permits_focusing(above->parent)) {
|
||||
LOG("Cannot move out of fullscreen container\n");
|
||||
return;
|
||||
}
|
||||
|
||||
DLOG("above = %p\n", above);
|
||||
Con *next;
|
||||
position_t position;
|
||||
|
|
|
@ -111,7 +111,6 @@ $left = open_window;
|
|||
my $right1 = open_window;
|
||||
cmd 'split v';
|
||||
my $right2 = open_window;
|
||||
$nodes = get_ws_content($tmp);
|
||||
|
||||
cmd 'focus parent';
|
||||
cmd 'fullscreen global';
|
||||
|
@ -234,4 +233,26 @@ is($x->input_focus, $right2->id, 'focus did not leave parent container (3)');
|
|||
cmd 'focus up';
|
||||
is($x->input_focus, $right22->id, 'focus did not leave parent container (4)');
|
||||
|
||||
################################################################################
|
||||
# Ensure that moving in a direction doesn't violate the focus restrictions.
|
||||
################################################################################
|
||||
|
||||
sub verify_move_prevented {
|
||||
my $msg = shift;
|
||||
my $nodes = get_ws_content($tmp2);
|
||||
my $split = $nodes->[1];
|
||||
my $fs = $split->{nodes}->[1];
|
||||
is(scalar @{$fs->{nodes}}, 2, $msg);
|
||||
}
|
||||
|
||||
cmd 'move left';
|
||||
verify_move_prevented('prevented move left');
|
||||
cmd 'move right';
|
||||
verify_move_prevented('prevented move right');
|
||||
cmd 'move down';
|
||||
verify_move_prevented('prevented move down');
|
||||
cmd 'move up';
|
||||
cmd 'move up';
|
||||
verify_move_prevented('prevented move up');
|
||||
|
||||
done_testing;
|
||||
|
|
Loading…
Reference in New Issue