testcases: use open_window everywhere
This commit is contained in:
parent
ec877f2ec4
commit
475dc3c532
|
@ -334,17 +334,10 @@ sub sync_with_i3 {
|
||||||
# one on the first call of sync_with_i3. It will be re-used in all
|
# one on the first call of sync_with_i3. It will be re-used in all
|
||||||
# subsequent calls.
|
# subsequent calls.
|
||||||
if (!defined($_sync_window)) {
|
if (!defined($_sync_window)) {
|
||||||
$_sync_window = $x->root->create_child(
|
$_sync_window = open_window(
|
||||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
rect => [ -15, -15, 10, 10 ],
|
||||||
rect => X11::XCB::Rect->new(x => -15, y => -15, width => 10, height => 10 ),
|
|
||||||
override_redirect => 1,
|
override_redirect => 1,
|
||||||
background_color => '#ff0000',
|
|
||||||
event_mask => [ 'structure_notify' ],
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$_sync_window->map;
|
|
||||||
|
|
||||||
wait_for_event 2, sub { $_[0]->{response_type} == MAP_NOTIFY };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
my $root = $x->get_root_window();
|
my $root = $x->get_root_window();
|
||||||
|
|
|
@ -2,23 +2,16 @@
|
||||||
# vim:ts=4:sw=4:expandtab
|
# vim:ts=4:sw=4:expandtab
|
||||||
|
|
||||||
use i3test;
|
use i3test;
|
||||||
use X11::XCB 'WINDOW_CLASS_INPUT_OUTPUT';
|
|
||||||
|
|
||||||
my $original_rect = X11::XCB::Rect->new(x => 0, y => 0, width => 30, height => 30);
|
my $original_rect = X11::XCB::Rect->new(x => 0, y => 0, width => 30, height => 30);
|
||||||
|
|
||||||
my $window = $x->root->create_child(
|
my $window = open_window(rect => $original_rect, dont_map => 1);
|
||||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
|
||||||
rect => $original_rect,
|
|
||||||
background_color => '#C0C0C0',
|
|
||||||
);
|
|
||||||
|
|
||||||
isa_ok($window, 'X11::XCB::Window');
|
isa_ok($window, 'X11::XCB::Window');
|
||||||
|
|
||||||
is_deeply($window->rect, $original_rect, "rect unmodified before mapping");
|
is_deeply($window->rect, $original_rect, "rect unmodified before mapping");
|
||||||
|
|
||||||
$window->map;
|
$window->map;
|
||||||
|
wait_for_map $window;
|
||||||
sleep(0.5);
|
|
||||||
|
|
||||||
my $new_rect = $window->rect;
|
my $new_rect = $window->rect;
|
||||||
ok(!eq_hash($new_rect, $original_rect), "Window got repositioned");
|
ok(!eq_hash($new_rect, $original_rect), "Window got repositioned");
|
||||||
|
|
|
@ -2,15 +2,13 @@
|
||||||
# vim:ts=4:sw=4:expandtab
|
# vim:ts=4:sw=4:expandtab
|
||||||
|
|
||||||
use i3test;
|
use i3test;
|
||||||
use X11::XCB 'WINDOW_CLASS_INPUT_OUTPUT';
|
|
||||||
|
|
||||||
my $original_rect = X11::XCB::Rect->new(x => 0, y => 0, width => 30, height => 30);
|
my $original_rect = X11::XCB::Rect->new(x => 0, y => 0, width => 30, height => 30);
|
||||||
|
|
||||||
my $window = $x->root->create_child(
|
my $window = open_window(
|
||||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
|
||||||
rect => $original_rect,
|
rect => $original_rect,
|
||||||
override_redirect => 1,
|
override_redirect => 1,
|
||||||
background_color => '#C0C0C0',
|
dont_map => 1,
|
||||||
);
|
);
|
||||||
|
|
||||||
isa_ok($window, 'X11::XCB::Window');
|
isa_ok($window, 'X11::XCB::Window');
|
||||||
|
|
|
@ -2,24 +2,12 @@
|
||||||
# vim:ts=4:sw=4:expandtab
|
# vim:ts=4:sw=4:expandtab
|
||||||
|
|
||||||
use i3test;
|
use i3test;
|
||||||
use X11::XCB 'WINDOW_CLASS_INPUT_OUTPUT';
|
|
||||||
|
|
||||||
# Create a floating window which is smaller than the minimum enforced size of i3
|
# Create a floating window which is smaller than the minimum enforced size of i3
|
||||||
my $window = $x->root->create_child(
|
my $window = open_floating_window;
|
||||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
|
||||||
rect => [ 0, 0, 30, 30],
|
|
||||||
background_color => '#C0C0C0',
|
|
||||||
# replace the type with 'utility' as soon as the coercion works again in X11::XCB
|
|
||||||
window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY'),
|
|
||||||
event_mask => [ 'structure_notify' ],
|
|
||||||
);
|
|
||||||
|
|
||||||
isa_ok($window, 'X11::XCB::Window');
|
isa_ok($window, 'X11::XCB::Window');
|
||||||
|
|
||||||
$window->map;
|
|
||||||
|
|
||||||
wait_for_map $window;
|
|
||||||
|
|
||||||
my ($absolute, $top) = $window->rect;
|
my ($absolute, $top) = $window->rect;
|
||||||
|
|
||||||
ok($window->mapped, 'Window is mapped');
|
ok($window->mapped, 'Window is mapped');
|
||||||
|
@ -30,20 +18,10 @@ ok($absolute->{x} != 0 && $absolute->{y} != 0, 'i3 did not map it to (0x0)');
|
||||||
|
|
||||||
$window->unmap;
|
$window->unmap;
|
||||||
|
|
||||||
$window = $x->root->create_child(
|
$window = open_floating_window(rect => [ 1, 1, 80, 90 ]);
|
||||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
|
||||||
rect => [ 1, 1, 80, 90],
|
|
||||||
background_color => '#C0C0C0',
|
|
||||||
window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY'),
|
|
||||||
event_mask => [ 'structure_notify' ],
|
|
||||||
);
|
|
||||||
|
|
||||||
isa_ok($window, 'X11::XCB::Window');
|
isa_ok($window, 'X11::XCB::Window');
|
||||||
|
|
||||||
$window->map;
|
|
||||||
|
|
||||||
wait_for_map $window;
|
|
||||||
|
|
||||||
($absolute, $top) = $window->rect;
|
($absolute, $top) = $window->rect;
|
||||||
|
|
||||||
cmp_ok($absolute->{width}, '==', 80, "i3 let the width at 80");
|
cmp_ok($absolute->{width}, '==', 80, "i3 let the width at 80");
|
||||||
|
@ -61,20 +39,10 @@ $window->unmap;
|
||||||
# at least the size of its initial geometry
|
# at least the size of its initial geometry
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
$window = $x->root->create_child(
|
$window = open_window(rect => [ 1, 1, 80, 90 ]);
|
||||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
|
||||||
rect => [ 1, 1, 80, 90],
|
|
||||||
background_color => '#C0C0C0',
|
|
||||||
#window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY'),
|
|
||||||
event_mask => [ 'structure_notify' ],
|
|
||||||
);
|
|
||||||
|
|
||||||
isa_ok($window, 'X11::XCB::Window');
|
isa_ok($window, 'X11::XCB::Window');
|
||||||
|
|
||||||
$window->map;
|
|
||||||
|
|
||||||
wait_for_map $window;
|
|
||||||
|
|
||||||
cmd 'floating enable';
|
cmd 'floating enable';
|
||||||
sync_with_i3;
|
sync_with_i3;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
# vim:ts=4:sw=4:expandtab
|
# vim:ts=4:sw=4:expandtab
|
||||||
|
|
||||||
use i3test;
|
use i3test;
|
||||||
use X11::XCB 'WINDOW_CLASS_INPUT_OUTPUT';
|
|
||||||
use List::Util qw(first);
|
use List::Util qw(first);
|
||||||
|
|
||||||
my $i3 = i3(get_socket_path());
|
my $i3 = i3(get_socket_path());
|
||||||
|
@ -32,11 +31,9 @@ for my $o (@outputs) {
|
||||||
|
|
||||||
my $original_rect = X11::XCB::Rect->new(x => 0, y => 0, width => 30, height => 30);
|
my $original_rect = X11::XCB::Rect->new(x => 0, y => 0, width => 30, height => 30);
|
||||||
|
|
||||||
my $window = $x->root->create_child(
|
my $window = open_window(
|
||||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
|
||||||
rect => $original_rect,
|
rect => $original_rect,
|
||||||
background_color => '#C0C0C0',
|
dont_map => 1,
|
||||||
event_mask => [ 'structure_notify' ],
|
|
||||||
);
|
);
|
||||||
|
|
||||||
isa_ok($window, 'X11::XCB::Window');
|
isa_ok($window, 'X11::XCB::Window');
|
||||||
|
@ -83,11 +80,9 @@ $window->unmap;
|
||||||
cmd 'open';
|
cmd 'open';
|
||||||
|
|
||||||
$original_rect = X11::XCB::Rect->new(x => 0, y => 0, width => 30, height => 30);
|
$original_rect = X11::XCB::Rect->new(x => 0, y => 0, width => 30, height => 30);
|
||||||
$window = $x->root->create_child(
|
$window = open_window(
|
||||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
|
||||||
rect => $original_rect,
|
rect => $original_rect,
|
||||||
background_color => 61440,
|
dont_map => 1,
|
||||||
event_mask => [ 'structure_notify' ],
|
|
||||||
);
|
);
|
||||||
|
|
||||||
is_deeply($window->rect, $original_rect, "rect unmodified before mapping");
|
is_deeply($window->rect, $original_rect, "rect unmodified before mapping");
|
||||||
|
@ -114,11 +109,9 @@ ok(abs($wrect->{height} - $orect->{height}) < $threshold, 'height coordinate ful
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
$original_rect = X11::XCB::Rect->new(x => 0, y => 0, width => 30, height => 30);
|
$original_rect = X11::XCB::Rect->new(x => 0, y => 0, width => 30, height => 30);
|
||||||
my $swindow = $x->root->create_child(
|
my $swindow = open_window(
|
||||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
|
||||||
rect => $original_rect,
|
rect => $original_rect,
|
||||||
background_color => '#C0C0C0',
|
dont_map => 1,
|
||||||
event_mask => [ 'structure_notify' ],
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$swindow->map;
|
$swindow->map;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
# Tests all kinds of matching methods
|
# Tests all kinds of matching methods
|
||||||
#
|
#
|
||||||
use i3test;
|
use i3test;
|
||||||
use X11::XCB qw(PROP_MODE_REPLACE WINDOW_CLASS_INPUT_OUTPUT);
|
use X11::XCB qw(PROP_MODE_REPLACE);
|
||||||
|
|
||||||
my $tmp = fresh_workspace;
|
my $tmp = fresh_workspace;
|
||||||
|
|
||||||
|
@ -69,31 +69,21 @@ sub set_wm_class {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
my $left = $x->root->create_child(
|
sub open_special {
|
||||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
my %args = @_;
|
||||||
rect => [ 0, 0, 30, 30 ],
|
my $wm_class = delete($args{wm_class}) || 'special';
|
||||||
background_color => '#0000ff',
|
|
||||||
event_mask => [ 'structure_notify' ],
|
|
||||||
);
|
|
||||||
|
|
||||||
$left->_create;
|
return open_window(
|
||||||
set_wm_class($left->id, 'special', 'special');
|
%args,
|
||||||
$left->name('left');
|
before_map => sub { set_wm_class($_->id, $wm_class, $wm_class) },
|
||||||
$left->map;
|
);
|
||||||
ok(wait_for_map($left), 'left window mapped');
|
}
|
||||||
|
|
||||||
my $right = $x->root->create_child(
|
my $left = open_special(name => 'left');
|
||||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
ok($left->mapped, 'left window mapped');
|
||||||
rect => [ 0, 0, 30, 30 ],
|
|
||||||
background_color => '#0000ff',
|
|
||||||
event_mask => [ 'structure_notify' ],
|
|
||||||
);
|
|
||||||
|
|
||||||
$right->_create;
|
my $right = open_special(name => 'right');
|
||||||
set_wm_class($right->id, 'special', 'special');
|
ok($right->mapped, 'right window mapped');
|
||||||
$right->name('right');
|
|
||||||
$right->map;
|
|
||||||
ok(wait_for_map($right), 'right window mapped');
|
|
||||||
|
|
||||||
# two windows should be here
|
# two windows should be here
|
||||||
$content = get_ws_content($tmp);
|
$content = get_ws_content($tmp);
|
||||||
|
@ -112,18 +102,8 @@ is(@{$content}, 1, 'one window still there');
|
||||||
|
|
||||||
$tmp = fresh_workspace;
|
$tmp = fresh_workspace;
|
||||||
|
|
||||||
$left = $x->root->create_child(
|
$left = open_special(name => 'left', wm_class => 'special7');
|
||||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
ok($left->mapped, 'left window mapped');
|
||||||
rect => [ 0, 0, 30, 30 ],
|
|
||||||
background_color => '#0000ff',
|
|
||||||
event_mask => [ 'structure_notify' ],
|
|
||||||
);
|
|
||||||
|
|
||||||
$left->_create;
|
|
||||||
set_wm_class($left->id, 'special7', 'special7');
|
|
||||||
$left->name('left');
|
|
||||||
$left->map;
|
|
||||||
ok(wait_for_map($left), 'left window mapped');
|
|
||||||
|
|
||||||
# two windows should be here
|
# two windows should be here
|
||||||
$content = get_ws_content($tmp);
|
$content = get_ws_content($tmp);
|
||||||
|
@ -142,18 +122,8 @@ is(@{$content}, 0, 'window killed');
|
||||||
|
|
||||||
$tmp = fresh_workspace;
|
$tmp = fresh_workspace;
|
||||||
|
|
||||||
$left = $x->root->create_child(
|
$left = open_special(name => 'ä 3', wm_class => 'special7');
|
||||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
ok($left->mapped, 'left window mapped');
|
||||||
rect => [ 0, 0, 30, 30 ],
|
|
||||||
background_color => '#0000ff',
|
|
||||||
event_mask => [ 'structure_notify' ],
|
|
||||||
);
|
|
||||||
|
|
||||||
$left->_create;
|
|
||||||
set_wm_class($left->id, 'special7', 'special7');
|
|
||||||
$left->name('ä 3');
|
|
||||||
$left->map;
|
|
||||||
ok(wait_for_map($left), 'left window mapped');
|
|
||||||
|
|
||||||
# two windows should be here
|
# two windows should be here
|
||||||
$content = get_ws_content($tmp);
|
$content = get_ws_content($tmp);
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
# Tests splitting
|
# Tests splitting
|
||||||
#
|
#
|
||||||
use i3test;
|
use i3test;
|
||||||
use X11::XCB qw(:all);
|
|
||||||
|
|
||||||
my $tmp = fresh_workspace;
|
my $tmp = fresh_workspace;
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
# found in 4be3178d4d360c2996217d811e61161c84d25898
|
# found in 4be3178d4d360c2996217d811e61161c84d25898
|
||||||
#
|
#
|
||||||
use i3test;
|
use i3test;
|
||||||
use X11::XCB 'WINDOW_CLASS_INPUT_OUTPUT';
|
|
||||||
|
|
||||||
my $i3 = i3(get_socket_path());
|
my $i3 = i3(get_socket_path());
|
||||||
|
|
||||||
|
@ -22,17 +21,10 @@ is(@docked, 0, 'no dock clients yet');
|
||||||
|
|
||||||
# open a dock client
|
# open a dock client
|
||||||
|
|
||||||
my $window = $x->root->create_child(
|
my $window = open_window(
|
||||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
|
||||||
rect => [ 0, 0, 30, 30],
|
|
||||||
background_color => '#FF0000',
|
|
||||||
window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'),
|
window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'),
|
||||||
);
|
);
|
||||||
|
|
||||||
$window->map;
|
|
||||||
|
|
||||||
sleep 0.25;
|
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
# check that we can find it in the layout tree at the expected position
|
# check that we can find it in the layout tree at the expected position
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
use i3test;
|
use i3test;
|
||||||
use X11::XCB qw(PROP_MODE_REPLACE WINDOW_CLASS_INPUT_OUTPUT);
|
use X11::XCB qw(PROP_MODE_REPLACE);
|
||||||
|
|
||||||
##############################################################
|
##############################################################
|
||||||
# 1: test the following directive:
|
# 1: test the following directive:
|
||||||
|
@ -25,16 +25,7 @@ my $pid = launch_with_config($config);
|
||||||
|
|
||||||
my $tmp = fresh_workspace;
|
my $tmp = fresh_workspace;
|
||||||
|
|
||||||
my $window = $x->root->create_child(
|
my $window = open_window(name => 'Border window');
|
||||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
|
||||||
rect => [ 0, 0, 30, 30 ],
|
|
||||||
background_color => '#00ff00',
|
|
||||||
event_mask => [ 'structure_notify' ],
|
|
||||||
);
|
|
||||||
|
|
||||||
$window->name('Border window');
|
|
||||||
$window->map;
|
|
||||||
wait_for_map $window;
|
|
||||||
|
|
||||||
my @content = @{get_ws_content($tmp)};
|
my @content = @{get_ws_content($tmp)};
|
||||||
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
||||||
|
@ -47,14 +38,6 @@ wait_for_unmap $window;
|
||||||
cmp_ok(@content, '==', 0, 'no more nodes');
|
cmp_ok(@content, '==', 0, 'no more nodes');
|
||||||
diag('content = '. Dumper(\@content));
|
diag('content = '. Dumper(\@content));
|
||||||
|
|
||||||
$window = $x->root->create_child(
|
|
||||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
|
||||||
rect => [ 0, 0, 30, 30 ],
|
|
||||||
background_color => '#00ff00',
|
|
||||||
event_mask => [ 'structure_notify' ],
|
|
||||||
);
|
|
||||||
|
|
||||||
$window->_create;
|
|
||||||
|
|
||||||
# TODO: move this to X11::XCB::Window
|
# TODO: move this to X11::XCB::Window
|
||||||
sub set_wm_class {
|
sub set_wm_class {
|
||||||
|
@ -75,10 +58,10 @@ sub set_wm_class {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
set_wm_class($window->id, 'borderless', 'borderless');
|
$window = open_window(
|
||||||
$window->name('Borderless window');
|
name => 'Borderless window',
|
||||||
$window->map;
|
before_map => sub { set_wm_class($_->id, 'borderless', 'borderless') },
|
||||||
wait_for_map $window;
|
);
|
||||||
|
|
||||||
@content = @{get_ws_content($tmp)};
|
@content = @{get_ws_content($tmp)};
|
||||||
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
||||||
|
@ -108,16 +91,7 @@ $pid = launch_with_config($config);
|
||||||
|
|
||||||
$tmp = fresh_workspace;
|
$tmp = fresh_workspace;
|
||||||
|
|
||||||
$window = $x->root->create_child(
|
$window = open_window(name => 'special title');
|
||||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
|
||||||
rect => [ 0, 0, 30, 30 ],
|
|
||||||
background_color => '#00ff00',
|
|
||||||
event_mask => [ 'structure_notify' ],
|
|
||||||
);
|
|
||||||
|
|
||||||
$window->name('special title');
|
|
||||||
$window->map;
|
|
||||||
wait_for_map $window;
|
|
||||||
|
|
||||||
@content = @{get_ws_content($tmp)};
|
@content = @{get_ws_content($tmp)};
|
||||||
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
||||||
|
@ -168,16 +142,7 @@ $pid = launch_with_config($config);
|
||||||
|
|
||||||
$tmp = fresh_workspace;
|
$tmp = fresh_workspace;
|
||||||
|
|
||||||
$window = $x->root->create_child(
|
$window = open_window(name => 'special mark title');
|
||||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
|
||||||
rect => [ 0, 0, 30, 30 ],
|
|
||||||
background_color => '#00ff00',
|
|
||||||
event_mask => [ 'structure_notify' ],
|
|
||||||
);
|
|
||||||
|
|
||||||
$window->name('special mark title');
|
|
||||||
$window->map;
|
|
||||||
wait_for_map $window;
|
|
||||||
|
|
||||||
@content = @{get_ws_content($tmp)};
|
@content = @{get_ws_content($tmp)};
|
||||||
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
||||||
|
@ -212,20 +177,11 @@ $pid = launch_with_config($config);
|
||||||
|
|
||||||
$tmp = fresh_workspace;
|
$tmp = fresh_workspace;
|
||||||
|
|
||||||
$window = $x->root->create_child(
|
$window = open_window(
|
||||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
name => 'usethis',
|
||||||
rect => [ 0, 0, 30, 30 ],
|
before_map => sub { set_wm_class($_->id, 'borderless', 'borderless') },
|
||||||
background_color => '#00ff00',
|
|
||||||
event_mask => [ 'structure_notify' ],
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$window->_create;
|
|
||||||
|
|
||||||
set_wm_class($window->id, 'borderless', 'borderless');
|
|
||||||
$window->name('usethis');
|
|
||||||
$window->map;
|
|
||||||
wait_for_map $window;
|
|
||||||
|
|
||||||
@content = @{get_ws_content($tmp)};
|
@content = @{get_ws_content($tmp)};
|
||||||
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
||||||
is($content[0]->{border}, 'none', 'no border');
|
is($content[0]->{border}, 'none', 'no border');
|
||||||
|
@ -268,20 +224,12 @@ $pid = launch_with_config($config);
|
||||||
|
|
||||||
$tmp = fresh_workspace;
|
$tmp = fresh_workspace;
|
||||||
|
|
||||||
$window = $x->root->create_child(
|
|
||||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
$window = open_window(
|
||||||
rect => [ 0, 0, 30, 30 ],
|
name => 'usethis',
|
||||||
background_color => '#00ff00',
|
before_map => sub { set_wm_class($_->id, 'bar', 'foo') },
|
||||||
event_mask => [ 'structure_notify' ],
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$window->_create;
|
|
||||||
|
|
||||||
set_wm_class($window->id, 'bar', 'foo');
|
|
||||||
$window->name('usethis');
|
|
||||||
$window->map;
|
|
||||||
wait_for_map $window;
|
|
||||||
|
|
||||||
@content = @{get_ws_content($tmp)};
|
@content = @{get_ws_content($tmp)};
|
||||||
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
||||||
is($content[0]->{border}, 'normal', 'normal border, not matched');
|
is($content[0]->{border}, 'normal', 'normal border, not matched');
|
||||||
|
@ -303,20 +251,11 @@ $pid = launch_with_config($config);
|
||||||
|
|
||||||
$tmp = fresh_workspace;
|
$tmp = fresh_workspace;
|
||||||
|
|
||||||
$window = $x->root->create_child(
|
$window = open_window(
|
||||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
name => 'usethis',
|
||||||
rect => [ 0, 0, 30, 30 ],
|
before_map => sub { set_wm_class($_->id, 'bar', 'foo') },
|
||||||
background_color => '#00ff00',
|
|
||||||
event_mask => [ 'structure_notify' ],
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$window->_create;
|
|
||||||
|
|
||||||
set_wm_class($window->id, 'bar', 'foo');
|
|
||||||
$window->name('usethis');
|
|
||||||
$window->map;
|
|
||||||
wait_for_map $window;
|
|
||||||
|
|
||||||
@content = @{get_ws_content($tmp)};
|
@content = @{get_ws_content($tmp)};
|
||||||
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
||||||
is($content[0]->{border}, 'none', 'no border');
|
is($content[0]->{border}, 'none', 'no border');
|
||||||
|
@ -340,20 +279,11 @@ $pid = launch_with_config($config);
|
||||||
|
|
||||||
$tmp = fresh_workspace;
|
$tmp = fresh_workspace;
|
||||||
|
|
||||||
$window = $x->root->create_child(
|
$window = open_window(
|
||||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
name => 'usethis',
|
||||||
rect => [ 0, 0, 30, 30 ],
|
before_map => sub { set_wm_class($_->id, 'bar', 'foo') },
|
||||||
background_color => '#00ff00',
|
|
||||||
event_mask => [ 'structure_notify' ],
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$window->_create;
|
|
||||||
|
|
||||||
set_wm_class($window->id, 'bar', 'foo');
|
|
||||||
$window->name('usethis');
|
|
||||||
$window->map;
|
|
||||||
wait_for_map $window;
|
|
||||||
|
|
||||||
@content = @{get_ws_content($tmp)};
|
@content = @{get_ws_content($tmp)};
|
||||||
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
||||||
is($content[0]->{border}, 'normal', 'normal border');
|
is($content[0]->{border}, 'normal', 'normal border');
|
||||||
|
@ -377,31 +307,24 @@ $pid = launch_with_config($config);
|
||||||
|
|
||||||
$tmp = fresh_workspace;
|
$tmp = fresh_workspace;
|
||||||
|
|
||||||
$window = $x->root->create_child(
|
$window = open_window(
|
||||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
name => 'usethis',
|
||||||
rect => [ 0, 0, 30, 30 ],
|
before_map => sub {
|
||||||
background_color => '#00ff00',
|
my ($window) = @_;
|
||||||
event_mask => [ 'structure_notify' ],
|
my $atomname = $x->atom(name => 'WM_WINDOW_ROLE');
|
||||||
|
my $atomtype = $x->atom(name => 'STRING');
|
||||||
|
$x->change_property(
|
||||||
|
PROP_MODE_REPLACE,
|
||||||
|
$window->id,
|
||||||
|
$atomname->id,
|
||||||
|
$atomtype->id,
|
||||||
|
8,
|
||||||
|
length("i3test") + 1,
|
||||||
|
"i3test\x00"
|
||||||
|
);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
$window->_create;
|
|
||||||
|
|
||||||
my $atomname = $x->atom(name => 'WM_WINDOW_ROLE');
|
|
||||||
my $atomtype = $x->atom(name => 'STRING');
|
|
||||||
$x->change_property(
|
|
||||||
PROP_MODE_REPLACE,
|
|
||||||
$window->id,
|
|
||||||
$atomname->id,
|
|
||||||
$atomtype->id,
|
|
||||||
8,
|
|
||||||
length("i3test") + 1,
|
|
||||||
"i3test\x00"
|
|
||||||
);
|
|
||||||
|
|
||||||
$window->name('usethis');
|
|
||||||
$window->map;
|
|
||||||
wait_for_map $window;
|
|
||||||
|
|
||||||
@content = @{get_ws_content($tmp)};
|
@content = @{get_ws_content($tmp)};
|
||||||
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
||||||
is($content[0]->{border}, 'none', 'no border (window_role)');
|
is($content[0]->{border}, 'none', 'no border (window_role)');
|
||||||
|
@ -426,25 +349,14 @@ $pid = launch_with_config($config);
|
||||||
|
|
||||||
$tmp = fresh_workspace;
|
$tmp = fresh_workspace;
|
||||||
|
|
||||||
$window = $x->root->create_child(
|
$window = open_window(name => 'usethis');
|
||||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
|
||||||
rect => [ 0, 0, 30, 30 ],
|
|
||||||
background_color => '#00ff00',
|
|
||||||
event_mask => [ 'structure_notify' ],
|
|
||||||
);
|
|
||||||
|
|
||||||
$window->_create;
|
|
||||||
|
|
||||||
$window->name('usethis');
|
|
||||||
$window->map;
|
|
||||||
wait_for_map $window;
|
|
||||||
|
|
||||||
@content = @{get_ws_content($tmp)};
|
@content = @{get_ws_content($tmp)};
|
||||||
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
cmp_ok(@content, '==', 1, 'one node on this workspace now');
|
||||||
is($content[0]->{border}, 'normal', 'normal border (window_role 2)');
|
is($content[0]->{border}, 'normal', 'normal border (window_role 2)');
|
||||||
|
|
||||||
$atomname = $x->atom(name => 'WM_WINDOW_ROLE');
|
my $atomname = $x->atom(name => 'WM_WINDOW_ROLE');
|
||||||
$atomtype = $x->atom(name => 'STRING');
|
my $atomtype = $x->atom(name => 'STRING');
|
||||||
$x->change_property(
|
$x->change_property(
|
||||||
PROP_MODE_REPLACE,
|
PROP_MODE_REPLACE,
|
||||||
$window->id,
|
$window->id,
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
# Tests if assignments work
|
# Tests if assignments work
|
||||||
#
|
#
|
||||||
use i3test;
|
use i3test;
|
||||||
use X11::XCB qw(PROP_MODE_REPLACE WINDOW_CLASS_INPUT_OUTPUT);
|
use X11::XCB qw(PROP_MODE_REPLACE);
|
||||||
|
|
||||||
# TODO: move to X11::XCB
|
# TODO: move to X11::XCB
|
||||||
sub set_wm_class {
|
sub set_wm_class {
|
||||||
|
@ -26,6 +26,16 @@ sub set_wm_class {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub open_special {
|
||||||
|
my %args = @_;
|
||||||
|
my $wm_class = delete($args{wm_class}) || 'special';
|
||||||
|
$args{name} //= 'special window';
|
||||||
|
|
||||||
|
return open_window(
|
||||||
|
%args,
|
||||||
|
before_map => sub { set_wm_class($_->id, $wm_class, $wm_class) },
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
# start a window and see that it does not get assigned with an empty config
|
# start a window and see that it does not get assigned with an empty config
|
||||||
|
@ -42,18 +52,7 @@ my $tmp = fresh_workspace;
|
||||||
|
|
||||||
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
|
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
|
||||||
|
|
||||||
my $window = $x->root->create_child(
|
my $window = open_special;
|
||||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
|
||||||
rect => [ 0, 0, 30, 30 ],
|
|
||||||
background_color => '#0000ff',
|
|
||||||
event_mask => [ 'structure_notify' ],
|
|
||||||
);
|
|
||||||
|
|
||||||
$window->_create;
|
|
||||||
set_wm_class($window->id, 'special', 'special');
|
|
||||||
$window->name('special window');
|
|
||||||
$window->map;
|
|
||||||
wait_for_map $window;
|
|
||||||
|
|
||||||
ok(@{get_ws_content($tmp)} == 1, 'special window got managed to current (random) workspace');
|
ok(@{get_ws_content($tmp)} == 1, 'special window got managed to current (random) workspace');
|
||||||
|
|
||||||
|
@ -80,18 +79,7 @@ ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
|
||||||
my $workspaces = get_workspace_names;
|
my $workspaces = get_workspace_names;
|
||||||
ok(!("targetws" ~~ @{$workspaces}), 'targetws does not exist yet');
|
ok(!("targetws" ~~ @{$workspaces}), 'targetws does not exist yet');
|
||||||
|
|
||||||
$window = $x->root->create_child(
|
$window = open_special;
|
||||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
|
||||||
rect => [ 0, 0, 30, 30 ],
|
|
||||||
background_color => '#0000ff',
|
|
||||||
event_mask => [ 'structure_notify' ],
|
|
||||||
);
|
|
||||||
|
|
||||||
$window->_create;
|
|
||||||
set_wm_class($window->id, 'special', 'special');
|
|
||||||
$window->name('special window');
|
|
||||||
$window->map;
|
|
||||||
wait_for_map $window;
|
|
||||||
|
|
||||||
ok(@{get_ws_content($tmp)} == 0, 'still no containers');
|
ok(@{get_ws_content($tmp)} == 0, 'still no containers');
|
||||||
ok("targetws" ~~ @{get_workspace_names()}, 'targetws exists');
|
ok("targetws" ~~ @{get_workspace_names()}, 'targetws exists');
|
||||||
|
@ -120,21 +108,12 @@ $tmp = fresh_workspace;
|
||||||
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
|
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
|
||||||
ok("targetws" ~~ @{get_workspace_names()}, 'targetws does not exist yet');
|
ok("targetws" ~~ @{get_workspace_names()}, 'targetws does not exist yet');
|
||||||
|
|
||||||
$window = $x->root->create_child(
|
|
||||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
|
||||||
rect => [ 0, 0, 30, 30 ],
|
|
||||||
background_color => '#0000ff',
|
|
||||||
event_mask => [ 'structure_notify' ],
|
|
||||||
);
|
|
||||||
|
|
||||||
$window->_create;
|
|
||||||
set_wm_class($window->id, 'special', 'special');
|
|
||||||
$window->name('special window');
|
|
||||||
$window->map;
|
|
||||||
|
|
||||||
# We use sync_with_i3 instead of wait_for_map here because i3 will not actually
|
# We use sync_with_i3 instead of wait_for_map here because i3 will not actually
|
||||||
# map the window -- it will be assigned to a different workspace and will only
|
# map the window -- it will be assigned to a different workspace and will only
|
||||||
# be mapped once you switch to that workspace
|
# be mapped once you switch to that workspace
|
||||||
|
$window = open_special(dont_map => 1);
|
||||||
|
$window->map;
|
||||||
sync_with_i3;
|
sync_with_i3;
|
||||||
|
|
||||||
ok(@{get_ws_content($tmp)} == 0, 'still no containers');
|
ok(@{get_ws_content($tmp)} == 0, 'still no containers');
|
||||||
|
@ -161,18 +140,7 @@ ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
|
||||||
$workspaces = get_workspace_names;
|
$workspaces = get_workspace_names;
|
||||||
ok(!("targetws" ~~ @{$workspaces}), 'targetws does not exist yet');
|
ok(!("targetws" ~~ @{$workspaces}), 'targetws does not exist yet');
|
||||||
|
|
||||||
$window = $x->root->create_child(
|
$window = open_special;
|
||||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
|
||||||
rect => [ 0, 0, 30, 30 ],
|
|
||||||
background_color => '#0000ff',
|
|
||||||
event_mask => [ 'structure_notify' ],
|
|
||||||
);
|
|
||||||
|
|
||||||
$window->_create;
|
|
||||||
set_wm_class($window->id, 'special', 'special');
|
|
||||||
$window->name('special window');
|
|
||||||
$window->map;
|
|
||||||
wait_for_map $window;
|
|
||||||
|
|
||||||
my $content = get_ws($tmp);
|
my $content = get_ws($tmp);
|
||||||
ok(@{$content->{nodes}} == 0, 'no tiling cons');
|
ok(@{$content->{nodes}} == 0, 'no tiling cons');
|
||||||
|
@ -202,18 +170,7 @@ ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
|
||||||
$workspaces = get_workspace_names;
|
$workspaces = get_workspace_names;
|
||||||
ok(!("targetws" ~~ @{$workspaces}), 'targetws does not exist yet');
|
ok(!("targetws" ~~ @{$workspaces}), 'targetws does not exist yet');
|
||||||
|
|
||||||
$window = $x->root->create_child(
|
$window = open_special(wm_class => 'SPEcial');
|
||||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
|
||||||
rect => [ 0, 0, 30, 30 ],
|
|
||||||
background_color => '#0000ff',
|
|
||||||
event_mask => [ 'structure_notify' ],
|
|
||||||
);
|
|
||||||
|
|
||||||
$window->_create;
|
|
||||||
set_wm_class($window->id, 'SPEcial', 'SPEcial');
|
|
||||||
$window->name('special window');
|
|
||||||
$window->map;
|
|
||||||
wait_for_map $window;
|
|
||||||
|
|
||||||
$content = get_ws($tmp);
|
$content = get_ws($tmp);
|
||||||
ok(@{$content->{nodes}} == 0, 'no tiling cons');
|
ok(@{$content->{nodes}} == 0, 'no tiling cons');
|
||||||
|
@ -251,20 +208,10 @@ my @docked = get_dock_clients;
|
||||||
# syntax
|
# syntax
|
||||||
is(@docked, 1, 'one dock client yet');
|
is(@docked, 1, 'one dock client yet');
|
||||||
|
|
||||||
$window = $x->root->create_child(
|
$window = open_special(
|
||||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
|
||||||
rect => [ 0, 0, 30, 30 ],
|
|
||||||
background_color => '#0000ff',
|
|
||||||
window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'),
|
window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'),
|
||||||
event_mask => [ 'structure_notify' ],
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$window->_create;
|
|
||||||
set_wm_class($window->id, 'special', 'special');
|
|
||||||
$window->name('special window');
|
|
||||||
$window->map;
|
|
||||||
wait_for_map $window;
|
|
||||||
|
|
||||||
$content = get_ws($tmp);
|
$content = get_ws($tmp);
|
||||||
ok(@{$content->{nodes}} == 0, 'no tiling cons');
|
ok(@{$content->{nodes}} == 0, 'no tiling cons');
|
||||||
ok(@{$content->{floating_nodes}} == 0, 'one floating con');
|
ok(@{$content->{floating_nodes}} == 0, 'one floating con');
|
||||||
|
@ -277,6 +224,4 @@ does_i3_live;
|
||||||
|
|
||||||
exit_gracefully($pid);
|
exit_gracefully($pid);
|
||||||
|
|
||||||
sleep 0.25;
|
|
||||||
|
|
||||||
done_testing;
|
done_testing;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
# assigned to an invisible workspace
|
# assigned to an invisible workspace
|
||||||
#
|
#
|
||||||
use i3test;
|
use i3test;
|
||||||
use X11::XCB qw(PROP_MODE_REPLACE WINDOW_CLASS_INPUT_OUTPUT);
|
use X11::XCB qw(PROP_MODE_REPLACE);
|
||||||
|
|
||||||
# TODO: move to X11::XCB
|
# TODO: move to X11::XCB
|
||||||
sub set_wm_class {
|
sub set_wm_class {
|
||||||
|
@ -27,6 +27,16 @@ sub set_wm_class {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub open_special {
|
||||||
|
my %args = @_;
|
||||||
|
my $wm_class = delete($args{wm_class}) || 'special';
|
||||||
|
$args{name} //= 'special window';
|
||||||
|
|
||||||
|
return open_window(
|
||||||
|
%args,
|
||||||
|
before_map => sub { set_wm_class($_->id, $wm_class, $wm_class) },
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
# start a window and see that it does not get assigned with an empty config
|
# start a window and see that it does not get assigned with an empty config
|
||||||
|
@ -45,18 +55,7 @@ my $tmp = fresh_workspace;
|
||||||
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
|
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
|
||||||
ok(get_ws($tmp)->{focused}, 'current workspace focused');
|
ok(get_ws($tmp)->{focused}, 'current workspace focused');
|
||||||
|
|
||||||
my $window = $x->root->create_child(
|
my $window = open_special;
|
||||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
|
||||||
rect => [ 0, 0, 30, 30 ],
|
|
||||||
background_color => '#0000ff',
|
|
||||||
);
|
|
||||||
|
|
||||||
$window->_create;
|
|
||||||
set_wm_class($window->id, 'special', 'special');
|
|
||||||
$window->name('special window');
|
|
||||||
$window->map;
|
|
||||||
sleep 0.25;
|
|
||||||
|
|
||||||
|
|
||||||
ok(@{get_ws_content($tmp)} == 0, 'special window not on current workspace');
|
ok(@{get_ws_content($tmp)} == 0, 'special window not on current workspace');
|
||||||
ok(@{get_ws_content('targetws')} == 1, 'special window on targetws');
|
ok(@{get_ws_content('targetws')} == 1, 'special window on targetws');
|
||||||
|
@ -66,20 +65,10 @@ ok(get_ws($tmp)->{focused}, 'current workspace still focused');
|
||||||
# the same test, but with a floating window
|
# the same test, but with a floating window
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
$window = $x->root->create_child(
|
$window = open_special(
|
||||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
|
||||||
rect => [ 0, 0, 30, 30 ],
|
|
||||||
background_color => '#0000ff',
|
|
||||||
window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY'),
|
window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY'),
|
||||||
);
|
);
|
||||||
|
|
||||||
$window->_create;
|
|
||||||
set_wm_class($window->id, 'special', 'special');
|
|
||||||
$window->name('special window');
|
|
||||||
$window->map;
|
|
||||||
sleep 0.25;
|
|
||||||
|
|
||||||
|
|
||||||
ok(@{get_ws_content($tmp)} == 0, 'special window not on current workspace');
|
ok(@{get_ws_content($tmp)} == 0, 'special window not on current workspace');
|
||||||
ok(@{get_ws_content('targetws')} == 1, 'special window on targetws');
|
ok(@{get_ws_content('targetws')} == 1, 'special window on targetws');
|
||||||
ok(get_ws($tmp)->{focused}, 'current workspace still focused');
|
ok(get_ws($tmp)->{focused}, 'current workspace still focused');
|
||||||
|
|
Loading…
Reference in New Issue