handlers.c: new focus should not end up behind fullscreen

This was raised here:
https://www.reddit.com/r/i3wm/comments/df18aa/popup_during_fullscreen_not_behaving_the_way_i/

With this commit, _NET_ACTIVE_WINDOW requests are more similar to
focusing with cmd_focus.
next
Orestis Floros 2019-10-09 02:32:22 +03:00
parent 34c217acc8
commit 6f82d21c39
No known key found for this signature in database
GPG Key ID: A09DBD7D3222C1C3
2 changed files with 20 additions and 11 deletions

View File

@ -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 i3s 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 dont need to set focus again */
focused_id = event->event;
tree_render();

View File

@ -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.