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.
This commit is contained in:
Michael Stapelberg 2012-09-25 15:40:08 +02:00
parent 0aa306890b
commit c31b3b296a
2 changed files with 39 additions and 0 deletions

View File

@ -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();

View File

@ -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
# its 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;