# vim:ts=4:sw=4:expandtab
use i3test;
-use X11::XCB qw(:all);
+use X11::XCB 'PROP_MODE_REPLACE';
use List::Util qw(first);
-BEGIN {
- use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection');
-}
-
-my $x = X11::XCB::Connection->new;
-
#####################################################################
# verify that there is no dock window yet
#####################################################################
my $primary = first { $_->primary } @{$screens};
# TODO: focus the primary screen before
-my $window = open_window($x, {
+my $window = open_window({
window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'),
});
$window->rect(X11::XCB::Rect->new(x => 0, y => 0, width => 50, height => 40));
-sync_with_i3 $x;
+sync_with_i3;
@docked = get_dock_clients('top');
is(@docked, 1, 'one dock client found');
$window->destroy;
-wait_for_unmap $x;
+wait_for_unmap $window;
@docked = get_dock_clients();
is(@docked, 0, 'no more dock clients');
# check if it gets placed on bottom (by coordinates)
#####################################################################
-$window = open_window($x, {
+$window = open_window({
rect => [ 0, 1000, 30, 30 ],
background_color => '#FF0000',
window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'),
$window->destroy;
-wait_for_unmap $x;
+wait_for_unmap $window;
@docked = get_dock_clients();
is(@docked, 0, 'no more dock clients');
# check if it gets placed on bottom (by hint)
#####################################################################
-$window = open_window($x, {
+$window = open_window({
dont_map => 1,
rect => [ 0, 1000, 30, 30 ],
background_color => '#FF0000',
$window->map;
-wait_for_map $x;
+wait_for_map $window;
@docked = get_dock_clients('top');
is(@docked, 1, 'dock client on top');
$window->destroy;
-wait_for_unmap $x;
+wait_for_unmap $window;
@docked = get_dock_clients();
is(@docked, 0, 'no more dock clients');
-$window = open_window($x, {
+$window = open_window({
dont_map => 1,
rect => [ 0, 1000, 30, 30 ],
background_color => '#FF0000',
$window->map;
-wait_for_map $x;
+wait_for_map $window;
@docked = get_dock_clients('bottom');
is(@docked, 1, 'dock client on bottom');
# regression test: transient dock client
#####################################################################
-my $fwindow = open_window($x, {
+my $fwindow = open_window({
dont_map => 1,
background_color => '#FF0000',
window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'),
$fwindow->transient_for($window);
$fwindow->map;
-wait_for_map $x;
+wait_for_map $fwindow;
does_i3_live;