wait_for_event 2, sub {
$_[0]->{response_type} == UNMAP_NOTIFY # and $_[0]->{window} == $id
};
- sync_with_i3($x);
+ sync_with_i3();
}
#
$window->map;
wait_for_map($window);
# We sync with i3 here to make sure $x->input_focus is updated.
- sync_with_i3($x);
+ sync_with_i3();
return $window;
}
# See also docs/testsuite for a long explanation
#
sub sync_with_i3 {
- my ($x) = @_;
-
# Since we need a (mapped) window for receiving a ClientMessage, we create
# one on the first call of sync_with_i3. It will be re-used in all
# subsequent calls.
sub input_focus {
my $self = shift;
- i3test::sync_with_i3($self);
+ i3test::sync_with_i3();
return $self->SUPER::input_focus(@_);
}
#
use i3test;
-my $result = sync_with_i3($x);
+my $result = sync_with_i3;
ok($result, 'syncing was successful');
done_testing;
# Switch to another workspace
fresh_workspace;
-sync_with_i3($x);
+sync_with_i3;
my $new_focus = $x->input_focus;
isnt($focus, $new_focus, "Focus changed");
wait_for_map $window;
cmd 'floating enable';
-sync_with_i3($x);
+sync_with_i3;
($absolute, $top) = $window->rect;
$window->fullscreen(1);
-sync_with_i3($x);
+sync_with_i3;
$new_rect = $window->rect;
ok(!eq_deeply($new_rect, $original_rect), "Window got repositioned after fullscreen");
$swindow->map;
-sync_with_i3($x);
+sync_with_i3;
ok(!$swindow->mapped, 'window not mapped while fullscreen window active');
ok(!eq_deeply($new_rect, $original_rect), "Window got repositioned");
$swindow->fullscreen(1);
-sync_with_i3($x);
+sync_with_i3;
is(fullscreen_windows(), 1, 'amount of fullscreen windows');
$window->fullscreen(0);
-sync_with_i3($x);
+sync_with_i3;
is(fullscreen_windows(), 0, 'amount of fullscreen windows');
ok($swindow->mapped, 'window mapped after other fullscreen ended');
###########################################################################
$swindow->fullscreen(0);
-sync_with_i3($x);
+sync_with_i3;
is(fullscreen_windows(), 0, 'amount of fullscreen windows after disabling');
my $msg = shift;
cmd $msg;
- sync_with_i3 $x;
+ sync_with_i3;
return $x->input_focus;
}
$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');
my $msg = shift;
cmd $msg;
- sync_with_i3($x);
+ sync_with_i3;
return $x->input_focus;
}
my ($a, $t) = $window->rect;
$window->rect(X11::XCB::Rect->new(x => $a->x, y => $a->y, width => $a->width, height => $a->height));
-sync_with_i3($x);
+sync_with_i3;
my ($na, $nt) = $window->rect;
is_deeply($na, $a, 'Rects are equal after configurerequest');
sub test_resize {
$window->rect(X11::XCB::Rect->new(x => 0, y => 0, width => 100, height => 100));
- sync_with_i3($x);
+ sync_with_i3;
my ($absolute, $top) = $window->rect;
$window->rect(X11::XCB::Rect->new(x => 0, y => 0, width => 300, height => 500));
- sync_with_i3($x);
+ sync_with_i3;
($absolute, $top) = $window->rect;
# Add the urgency hint, switch to a different workspace and back again
#####################################################################
$top->add_hint('urgency');
-sync_with_i3($x);
+sync_with_i3;
my @content = @{get_ws_content($tmp)};
@urgent = grep { $_->{urgent} } @content;
is(@urgent, 0, 'no window got the urgent flag after focusing');
$top->add_hint('urgency');
-sync_with_i3($x);
+sync_with_i3;
@urgent = grep { $_->{urgent} } @{get_ws_content($tmp)};
is(@urgent, 0, 'no window got the urgent flag after re-setting urgency hint');
my $otmp = fresh_workspace;
$top->add_hint('urgency');
-sync_with_i3($x);
+sync_with_i3;
$ws = get_ws($tmp);
ok($ws->{urgent}, 'urgent flag set on workspace');
cmd '[class="special" title="left"] kill';
-sync_with_i3($x);
+sync_with_i3;
$content = get_ws_content($tmp);
is(@{$content}, 1, 'one window still there');
$win->hints->aspect($aspect);
$x->flush;
-sync_with_i3($x);
+sync_with_i3;
my $rect = $win->rect;
my $ar = $rect->width / $rect->height;
cmd '[id="' . $second->id . '"] focus';
-sync_with_i3($x);
+sync_with_i3;
is($x->input_focus, $second->id, 'second con focused');
cmd '[id="' . $second->id . '"] focus';
-sync_with_i3($x);
+sync_with_i3;
is($x->input_focus, $second->id, 'second con focused');
cmd '[id="' . $second->id . '"] focus';
-sync_with_i3($x);
+sync_with_i3;
is($x->input_focus, $second->id, 'second con focused');
cmd 'floating enable';
-sync_with_i3($x);
+sync_with_i3;
# now kill the second one. focus should fall back to the third one, which is
# also floating
$first = open_window({ background_color => '#ff0000' }); # window 8
$second = open_window({ background_color => '#00ff00' }); # window 9
-sync_with_i3($x);
+sync_with_i3;
is($x->input_focus, $second->id, 'second container focused');
cmd 'focus tiling';
-sync_with_i3($x);
+sync_with_i3;
is($x->input_focus, $first->id, 'first (tiling) container focused');
cmd 'focus floating';
-sync_with_i3($x);
+sync_with_i3;
is($x->input_focus, $second->id, 'second (floating) container focused');
cmd 'focus floating';
-sync_with_i3($x);
+sync_with_i3;
is($x->input_focus, $second->id, 'second (floating) container still focused');
cmd 'focus mode_toggle';
-sync_with_i3($x);
+sync_with_i3;
is($x->input_focus, $first->id, 'first (tiling) container focused');
cmd 'focus mode_toggle';
-sync_with_i3($x);
+sync_with_i3;
is($x->input_focus, $second->id, 'second (floating) container focused');
$second = open_floating_window({ background_color => '#00ff00' }); # window 11
$third = open_floating_window({ background_color => '#0000ff' }); # window 12
-sync_with_i3($x);
+sync_with_i3;
is($x->input_focus, $third->id, 'third container focused');
cmd 'focus left';
-sync_with_i3($x);
+sync_with_i3;
is($x->input_focus, $second->id, 'second container focused');
cmd 'focus left';
-sync_with_i3($x);
+sync_with_i3;
is($x->input_focus, $first->id, 'first container focused');
cmd 'focus left';
-sync_with_i3($x);
+sync_with_i3;
is($x->input_focus, $third->id, 'focus wrapped to third container');
cmd 'focus right';
-sync_with_i3($x);
+sync_with_i3;
is($x->input_focus, $first->id, 'focus wrapped to first container');
cmd 'focus right';
-sync_with_i3($x);
+sync_with_i3;
is($x->input_focus, $second->id, 'focus on second container');
my $otmp = fresh_workspace;
-sync_with_i3($x);
+sync_with_i3;
ok(!$window->mapped, 'Window is not mapped after switching ws');
my $mid = open_window;
my $right = open_window;
-sync_with_i3($x);
+sync_with_i3;
diag("left = " . $left->id . ", mid = " . $mid->id . ", right = " . $right->id);
my $top = open_window;
my $bottom = open_window;
-sync_with_i3($x);
+sync_with_i3;
diag("top = " . $top->id . ", bottom = " . $bottom->id);
cmp_ok($absolute->{height}, '>', 150, 'i3 raised the height');
cmd 'floating toggle';
-sync_with_i3($x);
+sync_with_i3;
($absolute, $top) = $window->rect;
$third->map;
-sync_with_i3 $x;
+sync_with_i3;
diag("third = " . $third->id);
# verify that the third window has the focus
-sync_with_i3($x);
+sync_with_i3;
is($x->input_focus, $third->id, 'third window focused');
$window->add_hint('urgency');
-sync_with_i3($x);
+sync_with_i3;
does_i3_live;
my $window = open_window;
-sync_with_i3($x);
+sync_with_i3;
is($window->state, ICCCM_WM_STATE_NORMAL, 'WM_STATE normal');
my $first = open_window;
my $second = open_window;
- sync_with_i3 $x;
+ sync_with_i3;
is($x->input_focus, $second->id, 'second window focused');
ok(@{get_ws_content($tmp)} == 2, 'two containers opened');
is($content[0]->{border}, 'normal', 'normal border');
$window->name('special borderless title');
-sync_with_i3 $x;
+sync_with_i3;
@content = @{get_ws_content($tmp)};
is($content[0]->{border}, 'none', 'no border');
$window->name('special title');
-sync_with_i3 $x;
+sync_with_i3;
cmd 'border normal';
is($content[0]->{border}, 'normal', 'border reset to normal');
$window->name('special borderless title');
-sync_with_i3 $x;
+sync_with_i3;
@content = @{get_ws_content($tmp)};
is($content[0]->{border}, 'normal', 'still normal border');
$window->destroy;
# give i3 a chance to delete the window from its tree
-sync_with_i3 $x;
+sync_with_i3;
@content = @{get_ws_content($tmp)};
cmp_ok(@content, '==', 0, 'no nodes on this workspace now');
$x->flush;
-sync_with_i3 $x;
+sync_with_i3;
@content = @{get_ws_content($tmp)};
cmp_ok(@content, '==', 1, 'one node on this workspace now');
# 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
# be mapped once you switch to that workspace
-sync_with_i3 $x;
+sync_with_i3;
ok(@{get_ws_content($tmp)} == 0, 'still no containers');
ok(@{get_ws_content('targetws')} == 2, 'two containers on targetws');
my $first = open_window;
my $second = open_window;
-sync_with_i3($x);
+sync_with_i3;
is($x->input_focus, $second->id, 'second window focused');
my @content = @{get_ws_content($tmp)};
$first = open_window;
$second = open_window;
-sync_with_i3($x);
+sync_with_i3;
is($x->input_focus, $second->id, 'second window focused');
@content = @{get_ws_content($tmp)};
$third = open_window;
-sync_with_i3($x);
+sync_with_i3;
is($x->input_focus, $third->id, 'third window focused');
# We don’t use wait_for_map because the window will not get mapped -- it is on
# a different workspace.
# We sync with i3 here to make sure $x->input_focus is updated.
-sync_with_i3($x);
+sync_with_i3;
is(@{get_ws_content($second_ws)}, 0, 'still no containers on the second workspace');
is(@{get_ws_content($first_ws)}, 1, 'one container on the first workspace');
$win = open_window({ dont_map => 1, client_leader => $leader });
$win->map;
-sync_with_i3($x);
+sync_with_i3;
is(@{get_ws_content($second_ws)}, 0, 'still no containers on the second workspace');
is(@{get_ws_content($first_ws)}, 2, 'two containers on the first workspace');
######################################################################
complete_startup();
-sync_with_i3($x);
+sync_with_i3;
my $otherwin = open_window;
is(@{get_ws_content($second_ws)}, 1, 'one container on the second workspace');