2 # vim:ts=4:sw=4:expandtab
6 use X11::XCB::Connection;
9 my $x = X11::XCB::Connection->new;
11 my $tmp = fresh_workspace;
13 ##############################################################
14 # 1: test the following directive:
15 # for_window [class="borderless"] border none
16 # by first creating a window with a different class (should get
17 # the normal border), then creating a window with the class
18 # "borderless" (should get no border)
19 ##############################################################
21 my $window = $x->root->create_child(
22 class => WINDOW_CLASS_INPUT_OUTPUT,
23 rect => [ 0, 0, 30, 30 ],
24 background_color => '#00ff00',
27 $window->name('Border window');
31 my @content = @{get_ws_content($tmp)};
32 cmp_ok(@content, '==', 1, 'one node on this workspace now');
33 is($content[0]->{border}, 'normal', 'normal border');
38 my @content = @{get_ws_content($tmp)};
39 cmp_ok(@content, '==', 0, 'no more nodes');
40 diag('content = '. Dumper(\@content));
42 $window = $x->root->create_child(
43 class => WINDOW_CLASS_INPUT_OUTPUT,
44 rect => [ 0, 0, 30, 30 ],
45 background_color => '#00ff00',
50 # TODO: move this to X11::XCB::Window
52 my ($id, $class, $instance) = @_;
54 # Add a _NET_WM_STRUT_PARTIAL hint
55 my $atomname = $x->atom(name => 'WM_CLASS');
56 my $atomtype = $x->atom(name => 'STRING');
64 length($class) + length($instance) + 2,
65 "$instance\x00$class\x00"
69 set_wm_class($window->id, 'borderless', 'borderless');
70 $window->name('Borderless window');
74 @content = @{get_ws_content($tmp)};
75 cmp_ok(@content, '==', 1, 'one node on this workspace now');
76 is($content[0]->{border}, 'none', 'no border');
81 @content = @{get_ws_content($tmp)};
82 cmp_ok(@content, '==', 0, 'no more nodes');
84 ##############################################################
85 # 2: match on the title, check if for_window is really executed
87 ##############################################################
89 $window = $x->root->create_child(
90 class => WINDOW_CLASS_INPUT_OUTPUT,
91 rect => [ 0, 0, 30, 30 ],
92 background_color => '#00ff00',
95 $window->name('special title');
99 @content = @{get_ws_content($tmp)};
100 cmp_ok(@content, '==', 1, 'one node on this workspace now');
101 is($content[0]->{border}, 'normal', 'normal border');
103 $window->name('special borderless title');
106 @content = @{get_ws_content($tmp)};
107 is($content[0]->{border}, 'none', 'no border');
109 $window->name('special title');
114 @content = @{get_ws_content($tmp)};
115 is($content[0]->{border}, 'normal', 'border reset to normal');
117 $window->name('special borderless title');
120 @content = @{get_ws_content($tmp)};
121 is($content[0]->{border}, 'normal', 'still normal border');