2011-03-06 18:06:27 -05:00
|
|
|
#!perl
|
|
|
|
# vim:ts=4:sw=4:expandtab
|
|
|
|
#
|
|
|
|
# Test if new containers get focused when there is a fullscreen container at
|
2012-04-21 15:34:25 -04:00
|
|
|
# the time of launching the new one. Also make sure that focusing containers
|
|
|
|
# in other workspaces work even when there is a fullscreen container.
|
2011-03-06 18:06:27 -05:00
|
|
|
#
|
|
|
|
use i3test;
|
|
|
|
|
2011-07-25 07:35:56 -04:00
|
|
|
my $i3 = i3(get_socket_path());
|
2011-03-06 18:06:27 -05:00
|
|
|
|
2011-03-09 14:25:17 -05:00
|
|
|
my $tmp = fresh_workspace;
|
2011-03-06 18:06:27 -05:00
|
|
|
|
|
|
|
#####################################################################
|
|
|
|
# open the left window
|
|
|
|
#####################################################################
|
|
|
|
|
2011-11-21 18:47:32 -05:00
|
|
|
my $left = open_window({ background_color => '#ff0000' });
|
2011-03-06 18:06:27 -05:00
|
|
|
|
|
|
|
is($x->input_focus, $left->id, 'left window focused');
|
|
|
|
|
|
|
|
diag("left = " . $left->id);
|
|
|
|
|
|
|
|
#####################################################################
|
|
|
|
# Open the right window
|
|
|
|
#####################################################################
|
|
|
|
|
2011-11-21 18:47:32 -05:00
|
|
|
my $right = open_window({ background_color => '#00ff00' });
|
2011-03-06 18:06:27 -05:00
|
|
|
|
|
|
|
diag("right = " . $right->id);
|
|
|
|
|
|
|
|
#####################################################################
|
|
|
|
# Set the right window to fullscreen
|
|
|
|
#####################################################################
|
|
|
|
cmd 'nop setting fullscreen';
|
|
|
|
cmd 'fullscreen';
|
|
|
|
|
|
|
|
#####################################################################
|
|
|
|
# Open a third window
|
|
|
|
#####################################################################
|
|
|
|
|
2011-11-21 18:47:32 -05:00
|
|
|
my $third = open_window({
|
2011-09-24 10:11:37 -04:00
|
|
|
background_color => '#0000ff',
|
|
|
|
name => 'Third window',
|
|
|
|
dont_map => 1,
|
|
|
|
});
|
2011-09-24 08:08:02 -04:00
|
|
|
|
|
|
|
$third->map;
|
|
|
|
|
2011-11-21 19:13:37 -05:00
|
|
|
sync_with_i3;
|
2011-03-06 18:06:27 -05:00
|
|
|
|
|
|
|
diag("third = " . $third->id);
|
|
|
|
|
|
|
|
# move the fullscreen window to a different ws
|
|
|
|
|
|
|
|
my $tmp2 = get_unused_workspace;
|
|
|
|
|
|
|
|
cmd "move workspace $tmp2";
|
|
|
|
|
|
|
|
# verify that the third window has the focus
|
|
|
|
is($x->input_focus, $third->id, 'third window focused');
|
|
|
|
|
2012-01-07 13:18:36 -05:00
|
|
|
################################################################################
|
|
|
|
# Ensure that moving a window to a workspace which has a fullscreen window does
|
|
|
|
# not focus it (otherwise the user cannot get out of fullscreen mode anymore).
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
$tmp = fresh_workspace;
|
|
|
|
|
|
|
|
my $fullscreen_window = open_window;
|
|
|
|
cmd 'fullscreen';
|
|
|
|
|
|
|
|
my $nodes = get_ws_content($tmp);
|
|
|
|
is(scalar @$nodes, 1, 'precisely one window');
|
|
|
|
is($nodes->[0]->{focused}, 1, 'fullscreen window focused');
|
|
|
|
my $old_id = $nodes->[0]->{id};
|
|
|
|
|
|
|
|
$tmp2 = fresh_workspace;
|
|
|
|
my $move_window = open_window;
|
|
|
|
cmd "move workspace $tmp";
|
|
|
|
|
|
|
|
cmd "workspace $tmp";
|
|
|
|
|
|
|
|
$nodes = get_ws_content($tmp);
|
|
|
|
is(scalar @$nodes, 2, 'precisely two windows');
|
|
|
|
is($nodes->[0]->{id}, $old_id, 'id unchanged');
|
|
|
|
is($nodes->[0]->{focused}, 1, 'fullscreen window focused');
|
|
|
|
|
2012-04-21 15:34:25 -04:00
|
|
|
################################################################################
|
|
|
|
# Make sure it's possible to focus a container in a different workspace even if
|
|
|
|
# we are currently focusing a fullscreen container.
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
$tmp2 = fresh_workspace;
|
|
|
|
my $focusable_window = open_window;
|
|
|
|
|
|
|
|
cmd "workspace $tmp";
|
|
|
|
cmd '[id="' . $focusable_window->id . '"] focus';
|
|
|
|
|
|
|
|
is(focused_ws(), $tmp2, 'focus went to a different workspace');
|
|
|
|
|
|
|
|
$nodes = get_ws_content($tmp2);
|
|
|
|
is(scalar @$nodes, 1, 'precisely one window');
|
|
|
|
is($nodes->[0]->{focused}, 1, 'focusable window focused');
|
|
|
|
|
2011-03-06 18:06:27 -05:00
|
|
|
done_testing;
|