2 # vim:ts=4:sw=4:expandtab
3 # !NO_I3_INSTANCE! will prevent complete-run.pl from starting i3
5 # Regression: Checks if focus is stolen when a window is managed which is
6 # assigned to an invisible workspace
9 use X11::XCB qw(PROP_MODE_REPLACE WINDOW_CLASS_INPUT_OUTPUT);
11 # TODO: move to X11::XCB
13 my ($id, $class, $instance) = @_;
15 # Add a _NET_WM_STRUT_PARTIAL hint
16 my $atomname = $x->atom(name => 'WM_CLASS');
17 my $atomtype = $x->atom(name => 'STRING');
25 length($class) + length($instance) + 2,
26 "$instance\x00$class\x00"
31 #####################################################################
32 # start a window and see that it does not get assigned with an empty config
33 #####################################################################
37 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
38 assign "special" → targetws
41 my $pid = launch_with_config($config);
43 my $tmp = fresh_workspace;
45 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
46 ok(get_ws($tmp)->{focused}, 'current workspace focused');
48 my $window = $x->root->create_child(
49 class => WINDOW_CLASS_INPUT_OUTPUT,
50 rect => [ 0, 0, 30, 30 ],
51 background_color => '#0000ff',
55 set_wm_class($window->id, 'special', 'special');
56 $window->name('special window');
61 ok(@{get_ws_content($tmp)} == 0, 'special window not on current workspace');
62 ok(@{get_ws_content('targetws')} == 1, 'special window on targetws');
63 ok(get_ws($tmp)->{focused}, 'current workspace still focused');
65 #####################################################################
66 # the same test, but with a floating window
67 #####################################################################
69 $window = $x->root->create_child(
70 class => WINDOW_CLASS_INPUT_OUTPUT,
71 rect => [ 0, 0, 30, 30 ],
72 background_color => '#0000ff',
73 window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY'),
77 set_wm_class($window->id, 'special', 'special');
78 $window->name('special window');
83 ok(@{get_ws_content($tmp)} == 0, 'special window not on current workspace');
84 ok(@{get_ws_content('targetws')} == 1, 'special window on targetws');
85 ok(get_ws($tmp)->{focused}, 'current workspace still focused');
87 exit_gracefully($pid);