From 8bbf78fdd430a7e315356ebeda36adbf48b8953d Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Mon, 21 May 2018 17:21:01 -0400 Subject: [PATCH] Fix focus follows mouse with no focus --- sway/input/cursor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sway/input/cursor.c b/sway/input/cursor.c index e0b987d26..9a0b4f01b 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c @@ -147,10 +147,10 @@ void cursor_send_pointer_motion(struct sway_cursor *cursor, uint32_t time_msec, struct sway_container *c = container_at_coords(cursor->seat, cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy); if (c && config->focus_follows_mouse && allow_refocusing) { - if (c->type == C_WORKSPACE) { + struct sway_container *focus = seat_get_focus(cursor->seat); + if (focus && c->type == C_WORKSPACE) { // Only follow the mouse if it would move to a new output // Otherwise we'll focus the workspace, which is probably wrong - struct sway_container *focus = seat_get_focus(cursor->seat); if (focus->type != C_OUTPUT) { focus = container_parent(focus, C_OUTPUT); }