From 9c7c432560efcf8d7ffdbf85f291ac1dfe8e917e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 13 Mar 2025 08:36:40 +0530 Subject: [PATCH] macOS: Fix a regression causing a crash when using focus_follows_mouse Fixes #8437 --- kitty/mouse.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kitty/mouse.c b/kitty/mouse.c index ae67b6f1c..5a42bc27a 100644 --- a/kitty/mouse.c +++ b/kitty/mouse.c @@ -700,7 +700,12 @@ enter_event(int modifiers) { // On cocoa there is no way to configure the window manager to // focus windows on mouse enter, so we do it ourselves if (OPT(focus_follows_mouse) && !global_state.callback_os_window->is_focused) { + id_type wid = global_state.callback_os_window->id; focus_os_window(global_state.callback_os_window, false, NULL); + if (!global_state.callback_os_window) { + global_state.callback_os_window = os_window_for_id(wid); + if (!global_state.callback_os_window) return; + } } #endif // If the mouse is grabbed send a move event to update the cursor position