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;