2 # vim:ts=4:sw=4:expandtab
4 # Tests if the WM_TAKE_FOCUS protocol is correctly handled by i3
8 subtest 'Window without WM_TAKE_FOCUS', sub {
11 my $window = open_window;
12 # sync_with_i3 will send a ClientMessage to i3 and receive one targeted to
13 # $window->id. If it receives WM_TAKE_FOCUS instead, it will return 0, thus
15 ok(sync_with_i3(window_id => $window->id), 'did not receive ClientMessage');
20 subtest 'Window with WM_TAKE_FOCUS', sub {
23 my $take_focus = $x->atom(name => 'WM_TAKE_FOCUS');
25 my $window = open_window({
27 protocols => [ $take_focus ],
32 ok(wait_for_event(1, sub {
33 return 0 unless $_[0]->{response_type} == 161;
34 my ($data, $time) = unpack("L2", $_[0]->{data});
35 return ($data == $take_focus->id);
36 }), 'got ClientMessage with WM_TAKE_FOCUS atom');