]> git.sur5r.net Git - i3/i3/commitdiff
tests: fix setting the urgency hint
authorMichael Stapelberg <michael@stapelberg.de>
Tue, 24 Sep 2013 04:36:08 +0000 (06:36 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Tue, 24 Sep 2013 04:36:08 +0000 (06:36 +0200)
X11::XCB < 0.08 had a bug which caused this code to work even though it
shouldn’t.

testcases/t/113-urgent.t
testcases/t/200-urgency-timer.t

index 2eb853de1cd958c4880ac934aee76ba7698b7a9a..bb913819b108526371dbc1430813197e8d7dd80a 100644 (file)
@@ -24,8 +24,11 @@ my $_NET_WM_STATE_TOGGLE = 2;
 sub set_urgency {
     my ($win, $urgent_flag, $type) = @_;
     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->delete_hint('urgency') if (!$urgent_flag);
     } elsif ($type == 2) {
         my $msg = pack "CCSLLLLLL",
             X11::XCB::CLIENT_MESSAGE, # response_type
index 730a950a4aea8f316056f77e8d23c76831c365ed..0fb8c8be364a09a638bcbc5c7d858fdeafdedab3 100644 (file)
@@ -85,6 +85,7 @@ my $w2 = open_window;
 is($x->input_focus, $w2->id, 'window 2 focused');
 
 cmd "workspace $tmp2";
+$w->delete_hint('urgency');
 $w->add_hint('urgency');
 sync_with_i3;