Raise floating window to top when it gets focus

Applied for:
1. '[...] focus' for a floating container raises it to the top.
2. Focusing a window through a focus event raises it to the top.

Fixes #2572
This commit is contained in:
Orestis Floros
2017-09-22 22:00:06 +03:00
committed by Michael Stapelberg
parent 683e33199d
commit 8653bfe8d3
4 changed files with 36 additions and 5 deletions

View File

@ -216,4 +216,28 @@ cmd 'focus child';
is($x->input_focus, $floating->id, 'floating window focused');
#############################################################################
# 8: verify that focusing a floating window raises it to the top.
# This test can't verify that the floating container is visually on top, just
# that it is placed on the tail of the floating_head.
# See issue: 2572
#############################################################################
$tmp = fresh_workspace;
$first = open_floating_window;
$second = open_floating_window;
is($x->input_focus, $second->id, 'second floating window focused');
my $ws = get_ws($tmp);
is($ws->{floating_nodes}->[1]->{nodes}->[0]->{window}, $second->id, 'second on top');
is($ws->{floating_nodes}->[0]->{nodes}->[0]->{window}, $first->id, 'first behind');
cmd '[id=' . $first->id . '] focus';
is($x->input_focus, $first->id, 'first floating window focused');
$ws = get_ws($tmp);
is($ws->{floating_nodes}->[1]->{nodes}->[0]->{window}, $first->id, 'first on top');
is($ws->{floating_nodes}->[0]->{nodes}->[0]->{window}, $second->id, 'second behind');
done_testing;