Merge branch 'testsuite' into next
This commit is contained in:
commit
26750e7abc
|
@ -144,6 +144,12 @@ sub wait_for_unmap {
|
||||||
#
|
#
|
||||||
# set dont_map to a true value to avoid mapping
|
# set dont_map to a true value to avoid mapping
|
||||||
#
|
#
|
||||||
|
# if you want to change aspects of your window before it would be mapped,
|
||||||
|
# set before_map to a coderef. $window gets passed as $_ and as first argument.
|
||||||
|
#
|
||||||
|
# if you set both dont_map and before_map, the coderef will be called nevertheless
|
||||||
|
#
|
||||||
|
#
|
||||||
# default values:
|
# default values:
|
||||||
# class => WINDOW_CLASS_INPUT_OUTPUT
|
# class => WINDOW_CLASS_INPUT_OUTPUT
|
||||||
# rect => [ 0, 0, 30, 30 ]
|
# rect => [ 0, 0, 30, 30 ]
|
||||||
|
@ -152,10 +158,10 @@ sub wait_for_unmap {
|
||||||
# name => 'Window <n>'
|
# name => 'Window <n>'
|
||||||
#
|
#
|
||||||
sub open_window {
|
sub open_window {
|
||||||
my ($args) = @_;
|
my %args = @_ == 1 ? %{$_[0]} : @_;
|
||||||
my %args = ($args ? %$args : ());
|
|
||||||
|
|
||||||
my $dont_map = delete $args{dont_map};
|
my $dont_map = delete $args{dont_map};
|
||||||
|
my $before_map = delete $args{before_map};
|
||||||
|
|
||||||
$args{class} //= WINDOW_CLASS_INPUT_OUTPUT;
|
$args{class} //= WINDOW_CLASS_INPUT_OUTPUT;
|
||||||
$args{rect} //= [ 0, 0, 30, 30 ];
|
$args{rect} //= [ 0, 0, 30, 30 ];
|
||||||
|
@ -165,6 +171,12 @@ sub open_window {
|
||||||
|
|
||||||
my $window = $x->root->create_child(%args);
|
my $window = $x->root->create_child(%args);
|
||||||
|
|
||||||
|
if ($before_map) {
|
||||||
|
# TODO: investigate why _create is not needed
|
||||||
|
$window->_create;
|
||||||
|
$before_map->($window) for $window;
|
||||||
|
}
|
||||||
|
|
||||||
return $window if $dont_map;
|
return $window if $dont_map;
|
||||||
|
|
||||||
$window->map;
|
$window->map;
|
||||||
|
@ -175,8 +187,7 @@ sub open_window {
|
||||||
# Thin wrapper around open_window which sets window_type to
|
# Thin wrapper around open_window which sets window_type to
|
||||||
# _NET_WM_WINDOW_TYPE_UTILITY to make the window floating.
|
# _NET_WM_WINDOW_TYPE_UTILITY to make the window floating.
|
||||||
sub open_floating_window {
|
sub open_floating_window {
|
||||||
my ($args) = @_;
|
my %args = @_ == 1 ? %{$_[0]} : @_;
|
||||||
my %args = ($args ? %$args : ());
|
|
||||||
|
|
||||||
$args{window_type} = $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY');
|
$args{window_type} = $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY');
|
||||||
|
|
||||||
|
@ -323,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.25);
|
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,7 @@ cmd 'open';
|
||||||
my $floating = get_focused($tmp);
|
my $floating = get_focused($tmp);
|
||||||
diag("focused floating: " . get_focused($tmp));
|
diag("focused floating: " . get_focused($tmp));
|
||||||
cmd 'mode toggle';
|
cmd 'mode toggle';
|
||||||
# TODO: eliminate this race conditition
|
sync_with_i3;
|
||||||
sleep 1;
|
|
||||||
|
|
||||||
# kill old container
|
# kill old container
|
||||||
cmd qq|[con_id="$old"] focus|;
|
cmd qq|[con_id="$old"] focus|;
|
||||||
|
@ -33,7 +32,7 @@ cmd 'kill';
|
||||||
cmd qq|[con_id="$floating"] focus|;
|
cmd qq|[con_id="$floating"] focus|;
|
||||||
is(get_focused($tmp), $floating, 'floating window focused');
|
is(get_focused($tmp), $floating, 'floating window focused');
|
||||||
|
|
||||||
sleep 1;
|
sync_with_i3;
|
||||||
cmd 'mode toggle';
|
cmd 'mode toggle';
|
||||||
|
|
||||||
does_i3_live;
|
does_i3_live;
|
||||||
|
|
|
@ -42,9 +42,8 @@ isnt(get_focused($tmp), $second, 'different container focused');
|
||||||
##############################################################
|
##############################################################
|
||||||
|
|
||||||
cmd 'kill';
|
cmd 'kill';
|
||||||
# TODO: this testcase sometimes has different outcomes when the
|
sync_with_i3;
|
||||||
# sleep is missing. why?
|
|
||||||
sleep 0.25;
|
|
||||||
($nodes, $focus) = get_ws_content($tmp);
|
($nodes, $focus) = get_ws_content($tmp);
|
||||||
is($nodes->[1]->{nodes}->[0]->{id}, $second, 'second container found');
|
is($nodes->[1]->{nodes}->[0]->{id}, $second, 'second container found');
|
||||||
ok($nodes->[1]->{nodes}->[0]->{focused}, 'second container focused');
|
ok($nodes->[1]->{nodes}->[0]->{focused}, 'second container focused');
|
||||||
|
@ -103,8 +102,7 @@ my $win = open_window({ background_color => '#00ff00' });
|
||||||
|
|
||||||
cmd qq|[con_id="$middle"] focus|;
|
cmd qq|[con_id="$middle"] focus|;
|
||||||
$win->destroy;
|
$win->destroy;
|
||||||
|
sync_with_i3;
|
||||||
sleep 0.25;
|
|
||||||
|
|
||||||
is(get_focused($tmp), $middle, 'middle container focused');
|
is(get_focused($tmp), $middle, 'middle container focused');
|
||||||
|
|
||||||
|
|
|
@ -11,23 +11,24 @@ use List::Util qw(sum);
|
||||||
|
|
||||||
my $tmp = fresh_workspace;
|
my $tmp = fresh_workspace;
|
||||||
|
|
||||||
cmd 'exec /usr/bin/urxvt';
|
my $first = open_window;
|
||||||
sleep 0.5;
|
my $second = open_window;
|
||||||
cmd 'exec /usr/bin/urxvt';
|
|
||||||
sleep 0.5;
|
|
||||||
my ($nodes, $focus) = get_ws_content($tmp);
|
my ($nodes, $focus) = get_ws_content($tmp);
|
||||||
my $old_sum = sum map { $_->{rect}->{width} } @{$nodes};
|
my $old_sum = sum map { $_->{rect}->{width} } @{$nodes};
|
||||||
#cmd 'open';
|
|
||||||
cmd 'resize grow left 10 px or 25 ppt';
|
cmd 'resize grow left 10 px or 25 ppt';
|
||||||
cmd 'split v';
|
cmd 'split v';
|
||||||
#cmd 'open';
|
|
||||||
cmd 'exec /usr/bin/urxvt';
|
|
||||||
sleep 0.5;
|
|
||||||
cmd 'mode toggle';
|
|
||||||
sleep 0.5;
|
|
||||||
cmd 'kill';
|
|
||||||
|
|
||||||
sleep 0.5;
|
sync_with_i3;
|
||||||
|
|
||||||
|
my $third = open_window;
|
||||||
|
|
||||||
|
cmd 'mode toggle';
|
||||||
|
sync_with_i3;
|
||||||
|
|
||||||
|
cmd 'kill';
|
||||||
|
sync_with_i3;
|
||||||
|
|
||||||
($nodes, $focus) = get_ws_content($tmp);
|
($nodes, $focus) = get_ws_content($tmp);
|
||||||
my $new_sum = sum map { $_->{rect}->{width} } @{$nodes};
|
my $new_sum = sum map { $_->{rect}->{width} } @{$nodes};
|
||||||
|
|
|
@ -6,6 +6,11 @@
|
||||||
#
|
#
|
||||||
use i3test;
|
use i3test;
|
||||||
|
|
||||||
|
sub sync_cmd {
|
||||||
|
cmd @_;
|
||||||
|
sync_with_i3;
|
||||||
|
}
|
||||||
|
|
||||||
my $tmp = fresh_workspace;
|
my $tmp = fresh_workspace;
|
||||||
|
|
||||||
my $left = open_window;
|
my $left = open_window;
|
||||||
|
@ -13,23 +18,19 @@ my $mid = open_window;
|
||||||
my $right = open_window;
|
my $right = open_window;
|
||||||
|
|
||||||
# go to workspace level
|
# go to workspace level
|
||||||
cmd 'level up';
|
sync_cmd 'level up';
|
||||||
sleep 0.25;
|
|
||||||
|
|
||||||
# make it floating
|
# make it floating
|
||||||
cmd 'mode toggle';
|
sync_cmd 'mode toggle';
|
||||||
sleep 0.25;
|
|
||||||
|
|
||||||
# move the con outside the floating con
|
# move the con outside the floating con
|
||||||
cmd 'move up';
|
sync_cmd 'move up';
|
||||||
sleep 0.25;
|
|
||||||
|
|
||||||
does_i3_live;
|
does_i3_live;
|
||||||
|
|
||||||
# move another con outside
|
# move another con outside
|
||||||
cmd '[id="' . $mid->id . '"] focus';
|
sync_cmd '[id="' . $mid->id . '"] focus';
|
||||||
cmd 'move up';
|
sync_cmd 'move up';
|
||||||
sleep 0.25;
|
|
||||||
|
|
||||||
does_i3_live;
|
does_i3_live;
|
||||||
|
|
||||||
|
|
|
@ -10,20 +10,18 @@ my $tmp = fresh_workspace;
|
||||||
|
|
||||||
# open a tiling window on the first workspace
|
# open a tiling window on the first workspace
|
||||||
open_window;
|
open_window;
|
||||||
#sleep 0.25;
|
|
||||||
my $first = get_focused($tmp);
|
my $first = get_focused($tmp);
|
||||||
|
|
||||||
# on a different ws, open a floating window
|
# on a different ws, open a floating window
|
||||||
my $otmp = fresh_workspace;
|
my $otmp = fresh_workspace;
|
||||||
open_window;
|
open_window;
|
||||||
#sleep 0.25;
|
|
||||||
my $float = get_focused($otmp);
|
my $float = get_focused($otmp);
|
||||||
cmd 'mode toggle';
|
cmd 'mode toggle';
|
||||||
#sleep 0.25;
|
sync_with_i3;
|
||||||
|
|
||||||
# move the floating con to first workspace
|
# move the floating con to first workspace
|
||||||
cmd "move workspace $tmp";
|
cmd "move workspace $tmp";
|
||||||
#sleep 0.25;
|
sync_with_i3;
|
||||||
|
|
||||||
# switch to the first ws and check focus
|
# switch to the first ws and check focus
|
||||||
is(get_focused($tmp), $float, 'floating client correctly focused');
|
is(get_focused($tmp), $float, 'floating client correctly focused');
|
||||||
|
|
|
@ -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,18 +307,13 @@ $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(
|
||||||
$window->_create;
|
|
||||||
|
|
||||||
my $atomname = $x->atom(name => 'WM_WINDOW_ROLE');
|
|
||||||
my $atomtype = $x->atom(name => 'STRING');
|
|
||||||
$x->change_property(
|
|
||||||
PROP_MODE_REPLACE,
|
PROP_MODE_REPLACE,
|
||||||
$window->id,
|
$window->id,
|
||||||
$atomname->id,
|
$atomname->id,
|
||||||
|
@ -396,12 +321,10 @@ $x->change_property(
|
||||||
8,
|
8,
|
||||||
length("i3test") + 1,
|
length("i3test") + 1,
|
||||||
"i3test\x00"
|
"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;
|
||||||
|
|
|
@ -11,10 +11,10 @@ open_window;
|
||||||
open_window;
|
open_window;
|
||||||
|
|
||||||
cmd 'layout stacking';
|
cmd 'layout stacking';
|
||||||
sleep 1;
|
sync_with_i3;
|
||||||
|
|
||||||
cmd 'fullscreen';
|
cmd 'fullscreen';
|
||||||
sleep 1;
|
sync_with_i3;
|
||||||
|
|
||||||
cmd 'restart';
|
cmd 'restart';
|
||||||
sleep 1;
|
sleep 1;
|
||||||
|
|
|
@ -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