commands/focus: force container warp when fulfilling focus mode_toggle

This commit switches focusing behavior to force a warp when executing
`focus mode_toggle`.

Fixes #5772.
This commit is contained in:
Tudor Brindus 2020-10-31 19:56:40 -04:00 committed by Brian Ashworth
parent 8c12e71a66
commit 60d95414d4
4 changed files with 24 additions and 11 deletions

View file

@ -268,7 +268,16 @@ static struct cmd_results *focus_mode(struct sway_workspace *ws,
}
if (new_focus) {
seat_set_focus_container(seat, new_focus);
seat_consider_warp_to_focus(seat);
// If we're on the floating layer and the floating container area
// overlaps the position on the tiling layer that would be warped to,
// `seat_consider_warp_to_focus` would decide not to warp, but we need
// to anyway.
if (config->mouse_warping == WARP_CONTAINER) {
cursor_warp_to_container(seat->cursor, new_focus, true);
} else {
seat_consider_warp_to_focus(seat);
}
} else {
return cmd_results_new(CMD_FAILURE,
"Failed to find a %s container in workspace",