2 # vim:ts=4:sw=4:expandtab
6 use X11::XCB::Connection;
8 my $x = X11::XCB::Connection->new;
10 my $tmp = fresh_workspace;
12 #############################################################################
13 # 1: see if focus stays the same when toggling tiling/floating mode
14 #############################################################################
16 my $first = open_standard_window($x);
17 my $second = open_standard_window($x);
19 is($x->input_focus, $second->id, 'second window focused');
21 cmd 'floating enable';
22 cmd 'floating disable';
24 is($x->input_focus, $second->id, 'second window still focused after mode toggle');
26 #############################################################################
27 # 2: see if focus stays on the current floating window if killing another
29 #############################################################################
31 $tmp = fresh_workspace;
33 $first = open_standard_window($x); # window 2
34 $second = open_standard_window($x); # window 3
35 my $third = open_standard_window($x); # window 4
37 is($x->input_focus, $third->id, 'last container focused');
39 cmd 'floating enable';
41 cmd '[id="' . $second->id . '"] focus';
43 is($x->input_focus, $second->id, 'second con focused');
45 cmd 'floating enable';
47 # now kill the third one (it's floating). focus should stay unchanged
48 cmd '[id="' . $third->id . '"] kill';
52 is($x->input_focus, $second->id, 'second con still focused after killing third');
55 #############################################################################
56 # 3: see if the focus gets reverted correctly when closing floating clients
57 # (first to the next floating client, then to the last focused tiling client)
58 #############################################################################
60 $tmp = fresh_workspace;
62 $first = open_standard_window($x); # window 5
63 $second = open_standard_window($x); # window 6
64 my $third = open_standard_window($x); # window 7
66 is($x->input_focus, $third->id, 'last container focused');
68 cmd 'floating enable';
70 cmd '[id="' . $second->id . '"] focus';
72 is($x->input_focus, $second->id, 'second con focused');
74 cmd 'floating enable';
76 # now kill the second one. focus should fall back to the third one, which is
82 is($x->input_focus, $third->id, 'third con focused');
88 is($x->input_focus, $first->id, 'first con focused after killing all floating cons');