From bb9873ccd87ea35a7d2d228aea3d64e717f82a2f Mon Sep 17 00:00:00 2001 From: madblobfish Date: Sun, 6 Jan 2019 20:07:24 +0100 Subject: [PATCH] fix focus after workspace switch when focus_follows_mouse is always --- sway/input/seat.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sway/input/seat.c b/sway/input/seat.c index 18664d7cb..7c8fc4d32 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -21,6 +21,7 @@ #include "sway/output.h" #include "sway/tree/arrange.h" #include "sway/tree/container.h" +#include "sway/tree/node.h" #include "sway/tree/root.h" #include "sway/tree/view.h" #include "sway/tree/workspace.h" @@ -778,6 +779,14 @@ void seat_set_focus(struct sway_seat *seat, struct sway_node *node) { node_set_dirty(&new_output->node); } + // replace node to focus with node under cursor + if (config->focus_follows_mouse == FOLLOWS_ALWAYS) { + struct wlr_surface *surface = NULL; + double sx, sy; + node = node_at_cursor(seat, new_workspace, seat->cursor, &surface, &sx, &sy); + container = node->type == N_CONTAINER ? node->sway_container : NULL; + } + // find new output's old workspace, which might have to be removed if empty struct sway_workspace *new_output_last_ws = new_output ? output_get_active_workspace(new_output) : NULL;