Remanage window after urgency flag change

Fixes #5658
This commit is contained in:
Orestis Floros 2023-09-05 21:59:53 +02:00 committed by Michael Stapelberg
parent c1c405f4fc
commit 82b9821204
3 changed files with 26 additions and 3 deletions

View File

@ -0,0 +1 @@
fix for_window not working with urgency flags

View File

@ -422,6 +422,7 @@ static void handle_configure_request(xcb_configure_request_event_t *event) {
} else if (config.focus_on_window_activation == FOWA_URGENT || (config.focus_on_window_activation == FOWA_SMART && !workspace_is_visible(workspace))) {
DLOG("Marking con = %p urgent\n", con);
con_set_urgency(con, true);
con = remanage_window(con);
tree_render();
} else {
DLOG("Ignoring request for con = %p.\n", con);
@ -691,12 +692,16 @@ static void handle_client_message(xcb_client_message_event_t *event) {
}
} else if (event->data.data32[1] == A__NET_WM_STATE_DEMANDS_ATTENTION) {
/* Check if the urgent flag must be set or not */
if (event->data.data32[0] == _NET_WM_STATE_ADD)
if (event->data.data32[0] == _NET_WM_STATE_ADD) {
con_set_urgency(con, true);
else if (event->data.data32[0] == _NET_WM_STATE_REMOVE)
con = remanage_window(con);
} else if (event->data.data32[0] == _NET_WM_STATE_REMOVE) {
con_set_urgency(con, false);
else if (event->data.data32[0] == _NET_WM_STATE_TOGGLE)
con = remanage_window(con);
} else if (event->data.data32[0] == _NET_WM_STATE_TOGGLE) {
con_set_urgency(con, !con->urgent);
con = remanage_window(con);
}
} else if (event->data.data32[1] == A__NET_WM_STATE_STICKY) {
DLOG("Received a client message to modify _NET_WM_STATE_STICKY.\n");
if (event->data.data32[0] == _NET_WM_STATE_ADD)
@ -763,6 +768,7 @@ static void handle_client_message(xcb_client_message_event_t *event) {
} else if (config.focus_on_window_activation == FOWA_URGENT || (config.focus_on_window_activation == FOWA_SMART && !workspace_is_visible(ws))) {
DLOG("Marking con = %p urgent\n", con);
con_set_urgency(con, true);
con = remanage_window(con);
} else
DLOG("Ignoring request for con = %p.\n", con);
}
@ -982,6 +988,7 @@ static bool handle_hints(Con *con, xcb_get_property_reply_t *reply) {
bool urgency_hint;
window_update_hints(con->window, reply, &urgency_hint);
con_set_urgency(con, urgency_hint);
remanage_window(con);
tree_render();
return true;
}

View File

@ -50,6 +50,8 @@ my $config = <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
for_window [urgent=latest class=special] focus
force_display_urgency_hint 0ms
EOT
@ -360,6 +362,19 @@ for ($type = 1; $type <= 2; $type++) {
$win1_info = first { $_->{window} == $win1->id } @content;
ok(!$win1_info->{urgent}, 'win1 window is not marked urgent after focusing');
##############################################################################
#
##############################################################################
$tmp = fresh_workspace;
$win1 = open_window(wm_class => 'special');
$win2 = open_window;
is($x->input_focus, $win2->id, 'second window has focus');
cmd 'nop hello';
set_urgency($win1, 1, $type);
sync_with_i3;
is($x->input_focus, $win1->id, 'first window got focus');
##############################################################################
exit_gracefully($pid);