2 # vim:ts=4:sw=4:expandtab
3 # Checks if the focus is correctly restored, when creating a floating client
4 # over an unfocused tiling client and destroying the floating one again.
8 use Time::HiRes qw(sleep);
11 use_ok('X11::XCB::Window') or BAIL_OUT('Could not load X11::XCB::Window');
14 my $x = X11::XCB::Connection->new;
18 # Switch to the nineth workspace
19 $i3->command('9')->recv;
21 my $tiled_left = i3test::open_standard_window($x);
22 my $tiled_right = i3test::open_standard_window($x);
26 $i3->command('ml')->recv;
28 # Get input focus before creating the floating window
29 my $focus = $x->input_focus;
31 # Create a floating window which is smaller than the minimum enforced size of i3
32 my $window = $x->root->create_child(
33 class => WINDOW_CLASS_INPUT_OUTPUT,
34 rect => [ 1, 1, 30, 30],
35 background_color => '#C0C0C0',
36 type => $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY'),
39 isa_ok($window, 'X11::XCB::Window');
44 is($x->input_focus, $window->id, 'floating window focused');
50 is($x->input_focus, $focus, 'Focus correctly restored');
52 diag( "Testing i3, Perl $], $^X" );