Fix focus issue when moving windows across outputs

Fixes #3518

This fix avoids the issue of consuming our own warp events by never
calling warp on the wrong container.

Tried to add a test but it also succeeds with version before patch,
see #4604 for discussion

Co-Authored-By: Orestis <orestisflo@gmail.com>
This commit is contained in:
Anton Älgmyr 2021-10-17 13:42:11 +02:00 committed by Orestis Floros
parent 38cf8a21ef
commit 863a9eada4
No known key found for this signature in database
GPG Key ID: A09DBD7D3222C1C3
2 changed files with 12 additions and 2 deletions

View File

@ -0,0 +1 @@
fix focus when moving container between outputs with mouse warp and focus_follows_mouse

View File

@ -228,10 +228,19 @@ static void move_to_output_directed(Con *con, direction_t direction) {
* the focused container, con, is now a child of ws. To work around this
* and still produce the correct workspace focus events (see
* 517-regress-move-direction-ipc.t) we need to temporarily set focused
* to the old workspace. */
* to the old workspace.
*
* The following happen:
* 1. Focus con to push it on the top of the focus stack in its new
* workspace
* 2. Set focused to the old workspace to force workspace_show to
* execute
* 3. workspace_show will descend focus and target our con for
* focusing. This also ensures that the mouse warps correctly.
* See: #3518. */
con_focus(con);
focused = old_ws;
workspace_show(ws);
con_focus(con);
}
/* force re-painting the indicators */