2011-03-19 02:21:46 +01:00
|
|
|
#!perl
|
|
|
|
# vim:ts=4:sw=4:expandtab
|
|
|
|
#
|
|
|
|
# Tests if the WM_TAKE_FOCUS protocol is correctly handled by i3
|
|
|
|
#
|
|
|
|
use i3test;
|
|
|
|
|
|
|
|
subtest 'Window without WM_TAKE_FOCUS', sub {
|
2011-09-24 16:38:31 +02:00
|
|
|
fresh_workspace;
|
2011-03-19 02:21:46 +01:00
|
|
|
|
2011-11-22 00:47:32 +01:00
|
|
|
my $window = open_window;
|
2011-03-19 02:21:46 +01:00
|
|
|
|
2011-11-21 23:37:04 +01:00
|
|
|
ok(!wait_for_event(1, sub { $_[0]->{response_type} == 161 }), 'did not receive ClientMessage');
|
2011-05-25 20:16:14 +02:00
|
|
|
|
|
|
|
done_testing;
|
2011-03-19 02:21:46 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
subtest 'Window with WM_TAKE_FOCUS', sub {
|
2011-09-24 16:38:31 +02:00
|
|
|
fresh_workspace;
|
2011-03-19 02:21:46 +01:00
|
|
|
|
2011-09-24 16:38:31 +02:00
|
|
|
my $take_focus = $x->atom(name => 'WM_TAKE_FOCUS');
|
2011-03-19 02:21:46 +01:00
|
|
|
|
2011-11-22 00:47:32 +01:00
|
|
|
my $window = open_window({
|
2011-09-24 16:38:31 +02:00
|
|
|
dont_map => 1,
|
|
|
|
protocols => [ $take_focus ],
|
|
|
|
});
|
2011-03-19 02:21:46 +01:00
|
|
|
|
|
|
|
$window->map;
|
|
|
|
|
2011-11-21 23:37:04 +01:00
|
|
|
ok(wait_for_event(1, sub {
|
2011-09-24 16:38:31 +02:00
|
|
|
return 0 unless $_[0]->{response_type} == 161;
|
|
|
|
my ($data, $time) = unpack("L2", $_[0]->{data});
|
|
|
|
return ($data == $take_focus->id);
|
|
|
|
}), 'got ClientMessage with WM_TAKE_FOCUS atom');
|
2011-05-25 20:16:14 +02:00
|
|
|
|
|
|
|
done_testing;
|
2011-03-19 02:21:46 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
done_testing;
|