From c31b3b296a9c30073ac133ccfe8e02fb57a37c3f Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Tue, 25 Sep 2012 15:40:08 +0200 Subject: [PATCH] Bugfix: Correctly clear the urgency hint when the window is underneath a split-con (+test) Previously, when you had an urgent container in a stack on some invisible workspace (say urxvt) and you switched to it, the urgency hint was not properly cleared. --- src/workspace.c | 1 + testcases/t/200-urgency-timer.t | 38 +++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/src/workspace.c b/src/workspace.c index 3f09ea99..3a5844cb 100644 --- a/src/workspace.c +++ b/src/workspace.c @@ -322,6 +322,7 @@ static void workspace_defer_update_urgent_hint_cb(EV_P_ ev_timer *w, int revents DLOG("Resetting urgency flag of con %p by timer\n", con); con->urgent = false; + con_update_parents_urgency(con); workspace_update_urgent_flag(con_get_workspace(con)); tree_render(); diff --git a/testcases/t/200-urgency-timer.t b/testcases/t/200-urgency-timer.t index 9e1a90a5..730a950a 100644 --- a/testcases/t/200-urgency-timer.t +++ b/testcases/t/200-urgency-timer.t @@ -106,6 +106,44 @@ cmd '[id="' . $w->id . '"] focus'; @urgent = grep { $_->{urgent} } @content; is(@urgent, 0, 'window 1 not marked as urgent anymore'); +################################################################################ +# open a stack, mark one window as urgent, switch to that workspace and verify +# it’s cleared correctly. +################################################################################ + +sub count_total_urgent { + my ($con) = @_; + + my $urgent = ($con->{urgent} ? 1 : 0); + $urgent += count_total_urgent($_) for (@{$con->{nodes}}, @{$con->{floating_nodes}}); + return $urgent; +} + +my $tmp3 = fresh_workspace; +open_window; +open_window; +cmd 'split v'; +my $split_left = open_window; +cmd 'layout stacked'; + +cmd "workspace $tmp2"; + +is(count_total_urgent(get_ws($tmp3)), 0, "no urgent windows on workspace $tmp3"); + +$split_left->add_hint('urgency'); +sync_with_i3; + +cmp_ok(count_total_urgent(get_ws($tmp3)), '>=', 0, "more than one urgent window on workspace $tmp3"); + +cmd "workspace $tmp3"; + +# Remove the urgency hint. +$split_left->delete_hint('urgency'); +sync_with_i3; + +sleep(0.2); +is(count_total_urgent(get_ws($tmp3)), 0, "no more urgent windows on workspace $tmp3"); + exit_gracefully($pid); done_testing; -- 2.39.5