Don't call con_fullscreen_permits_focusing with ignore_focus

When we don't modify the focus we aren't risking giving focus to a
container behind the current fullscreen one.

_con_move_to_con can with ignore_focus is called through the swap
command or through con_move_to_workspace for floating containers. This
change shouldn't break the expectations of the callers there.

Fixes issue #3259.
This commit is contained in:
Orestis Floros 2018-04-22 03:26:51 +03:00
parent 799e3951a2
commit b5f887287a
No known key found for this signature in database
GPG Key ID: E9AD9F32E401E38F
2 changed files with 19 additions and 14 deletions

View File

@ -1097,7 +1097,7 @@ static bool _con_move_to_con(Con *con, Con *target, bool behind_focused, bool fi
/* Prevent moving if this would violate the fullscreen focus restrictions. */
Con *target_ws = con_get_workspace(target);
if (!con_fullscreen_permits_focusing(target_ws)) {
if (!ignore_focus && !con_fullscreen_permits_focusing(target_ws)) {
LOG("Cannot move out of a fullscreen container.\n");
return false;
}

View File

@ -372,14 +372,18 @@ for my $fullscreen (@fullscreen_permutations){
# +---+---+ Layout: H2[ B, F ]
# | B | F | Focus Stacks:
# +---+---+ H2: F, B
#
# See issue: #3259
###############################################################################
for my $fullscreen (0..1){
$ws1 = fresh_workspace;
$A = open_window(wm_class => 'mark_A');
$ws2 = fresh_workspace;
$B = open_window(wm_class => 'mark_B');
open_window;
cmd 'fullscreen enable' if $fullscreen;
$expected_focus = get_focused($ws2);
cmd '[con_mark=B] swap container with mark A';
@ -392,6 +396,7 @@ is($nodes->[0]->{window}, $A->{id}, 'A is on the left of the second workspace');
is(get_focused($ws2), $expected_focus, 'F is still focused');
kill_all_windows;
}
###############################################################################
# 1. A container cannot be swapped with its parent.