diff options
author | Orestis Floros <orestisflo@gmail.com> | 2023-09-05 21:59:53 +0200 |
---|---|---|
committer | Michael Stapelberg <stapelberg@users.noreply.github.com> | 2023-09-06 17:24:53 +0200 |
commit | 82b9821204901e6a3dd4cec5bcd8ef52e5dd12fe (patch) | |
tree | cef8025d488ba517c6d7757b7f680912e84a3bd2 | |
parent | c1c405f4fc292321d8ef810b82d48abbbdb7b1a1 (diff) | |
download | i3-82b9821204901e6a3dd4cec5bcd8ef52e5dd12fe.tar.gz i3-82b9821204901e6a3dd4cec5bcd8ef52e5dd12fe.zip |
Remanage window after urgency flag change
Fixes #5658
-rw-r--r-- | release-notes/bugfixes/5-for-window-urgent | 1 | ||||
-rw-r--r-- | src/handlers.c | 13 | ||||
-rw-r--r-- | testcases/t/113-urgent.t | 15 |
3 files changed, 26 insertions, 3 deletions
diff --git a/release-notes/bugfixes/5-for-window-urgent b/release-notes/bugfixes/5-for-window-urgent new file mode 100644 index 00000000..344b3fb2 --- /dev/null +++ b/release-notes/bugfixes/5-for-window-urgent @@ -0,0 +1 @@ +fix for_window not working with urgency flags diff --git a/src/handlers.c b/src/handlers.c index 17968a43..6ba11708 100644 --- a/src/handlers.c +++ b/src/handlers.c @@ -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; } diff --git a/testcases/t/113-urgent.t b/testcases/t/113-urgent.t index f78226e3..f99b1942 100644 --- a/testcases/t/113-urgent.t +++ b/testcases/t/113-urgent.t @@ -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 @@ -361,6 +363,19 @@ for ($type = 1; $type <= 2; $type++) { 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); } |