diff --git a/src/handlers.c b/src/handlers.c index 7a334978..3a83d6a4 100644 --- a/src/handlers.c +++ b/src/handlers.c @@ -412,7 +412,7 @@ static void handle_configure_request(xcb_configure_request_event_t *event) { if (config.focus_on_window_activation == FOWA_FOCUS || (config.focus_on_window_activation == FOWA_SMART && workspace_is_visible(workspace))) { DLOG("Focusing con = %p\n", con); workspace_show(workspace); - con_activate(con); + con_activate_unblock(con); tree_render(); } 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); @@ -758,7 +758,7 @@ static void handle_client_message(xcb_client_message_event_t *event) { workspace_show(ws); /* Re-set focus, even if unchanged from i3’s perspective. */ focused_id = XCB_NONE; - con_activate(con); + con_activate_unblock(con); } } else { /* Request is from an application. */ @@ -769,8 +769,7 @@ static void handle_client_message(xcb_client_message_event_t *event) { if (config.focus_on_window_activation == FOWA_FOCUS || (config.focus_on_window_activation == FOWA_SMART && workspace_is_visible(ws))) { DLOG("Focusing con = %p\n", con); - workspace_show(ws); - con_activate(con); + con_activate_unblock(con); } 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); @@ -1115,14 +1114,8 @@ static void handle_focus_in(xcb_focus_in_event_t *event) { DLOG("focus is different / refocusing floating window: updating decorations\n"); - /* Get the currently focused workspace to check if the focus change also - * involves changing workspaces. If so, we need to call workspace_show() to - * correctly update state and send the IPC event. */ - Con *ws = con_get_workspace(con); - if (ws != con_get_workspace(focused)) - workspace_show(ws); + con_activate_unblock(con); - con_activate(con); /* We update focused_id because we don’t need to set focus again */ focused_id = event->event; tree_render(); diff --git a/testcases/t/195-net-active-window.t b/testcases/t/195-net-active-window.t index f9f883cb..4ce12089 100644 --- a/testcases/t/195-net-active-window.t +++ b/testcases/t/195-net-active-window.t @@ -149,6 +149,22 @@ send_net_active_window($scratch->id, 'pager'); is($x->input_focus, $scratch->id, 'scratchpad window is shown'); +################################################################################ +# Send a _NET_ACTIVE_WINDOW ClientMessage for a window behind a fullscreen +# window +################################################################################ + +$ws1 = fresh_workspace; +$win1 = open_window; +$win2 = open_window; +cmd 'fullscreen enable'; +is_num_fullscreen($ws1, 1, '1 fullscreen window in workspace'); + +send_net_active_window($win1->id); + +is($x->input_focus, $win1->id, 'window behind fullscreen window is now focused'); +is_num_fullscreen($ws1, 0, 'no fullscreen windows in workspace'); + ################################################################################ # Verify that the _NET_ACTIVE_WINDOW property is updated on the root window # correctly.