tests: fix setting the urgency hint

X11::XCB < 0.08 had a bug which caused this code to work even though it
shouldn’t.
This commit is contained in:
Michael Stapelberg 2013-09-24 06:36:08 +02:00
parent d6b1f1a1b2
commit 3ba8642efd
2 changed files with 5 additions and 1 deletions

View File

@ -24,8 +24,11 @@ my $_NET_WM_STATE_TOGGLE = 2;
sub set_urgency { sub set_urgency {
my ($win, $urgent_flag, $type) = @_; my ($win, $urgent_flag, $type) = @_;
if ($type == 1) { if ($type == 1) {
# Because X11::XCB does not keep track of clearing the urgency hint
# when receiving focus, we just delete it in all cases and then re-set
# it if appropriate.
$win->delete_hint('urgency');
$win->add_hint('urgency') if ($urgent_flag); $win->add_hint('urgency') if ($urgent_flag);
$win->delete_hint('urgency') if (!$urgent_flag);
} elsif ($type == 2) { } elsif ($type == 2) {
my $msg = pack "CCSLLLLLL", my $msg = pack "CCSLLLLLL",
X11::XCB::CLIENT_MESSAGE, # response_type X11::XCB::CLIENT_MESSAGE, # response_type

View File

@ -85,6 +85,7 @@ my $w2 = open_window;
is($x->input_focus, $w2->id, 'window 2 focused'); is($x->input_focus, $w2->id, 'window 2 focused');
cmd "workspace $tmp2"; cmd "workspace $tmp2";
$w->delete_hint('urgency');
$w->add_hint('urgency'); $w->add_hint('urgency');
sync_with_i3; sync_with_i3;