2 # vim:ts=4:sw=4:expandtab
4 # Test if new containers get focused when there is a fullscreen container at
5 # the time of launching the new one.
11 use_ok('X11::XCB::Window');
14 my $x = X11::XCB::Connection->new;
15 my $i3 = i3(get_socket_path());
17 my $tmp = fresh_workspace;
19 #####################################################################
20 # open the left window
21 #####################################################################
23 my $left = open_window($x, { background_color => '#ff0000' });
25 is($x->input_focus, $left->id, 'left window focused');
27 diag("left = " . $left->id);
29 #####################################################################
30 # Open the right window
31 #####################################################################
33 my $right = open_window($x, { background_color => '#00ff00' });
35 diag("right = " . $right->id);
37 #####################################################################
38 # Set the right window to fullscreen
39 #####################################################################
40 cmd 'nop setting fullscreen';
43 #####################################################################
45 #####################################################################
47 my $third = open_window($x, {
48 background_color => '#0000ff',
49 name => 'Third window',
57 diag("third = " . $third->id);
59 # move the fullscreen window to a different ws
61 my $tmp2 = get_unused_workspace;
63 cmd "move workspace $tmp2";
65 # verify that the third window has the focus
69 is($x->input_focus, $third->id, 'third window focused');
71 ################################################################################
72 # Ensure that moving a window to a workspace which has a fullscreen window does
73 # not focus it (otherwise the user cannot get out of fullscreen mode anymore).
74 ################################################################################
76 $tmp = fresh_workspace;
78 my $fullscreen_window = open_window;
81 my $nodes = get_ws_content($tmp);
82 is(scalar @$nodes, 1, 'precisely one window');
83 is($nodes->[0]->{focused}, 1, 'fullscreen window focused');
84 my $old_id = $nodes->[0]->{id};
86 $tmp2 = fresh_workspace;
87 my $move_window = open_window;
88 cmd "move workspace $tmp";
92 $nodes = get_ws_content($tmp);
93 is(scalar @$nodes, 2, 'precisely two windows');
94 is($nodes->[0]->{id}, $old_id, 'id unchanged');
95 is($nodes->[0]->{focused}, 1, 'fullscreen window focused');