From ac6c652a4dd66dcac5a968a4bd312f6c315922f8 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 4 Mar 2025 09:49:34 +0530 Subject: [PATCH] Fix #8398 --- glfw/input.c | 6 +++--- kitty/glfw.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/glfw/input.c b/glfw/input.c index 6e8c16ed2..c3ff583e4 100644 --- a/glfw/input.c +++ b/glfw/input.c @@ -728,10 +728,10 @@ GLFWAPI void glfwSetInputMode(GLFWwindow* handle, int mode, int value) window->cursorMode = value; - _glfwPlatformGetCursorPos(window, - &window->virtualCursorPosX, - &window->virtualCursorPosY); + double x, y; + _glfwPlatformGetCursorPos(window, &x, &y); _glfwPlatformSetCursorMode(window, value); + _glfwInputCursorPos(window, x, y); } else if (mode == GLFW_STICKY_KEYS) { diff --git a/kitty/glfw.c b/kitty/glfw.c index aa5784a21..e6d31416e 100644 --- a/kitty/glfw.c +++ b/kitty/glfw.c @@ -446,12 +446,12 @@ cursor_enter_callback(GLFWwindow *w, int entered) { double x, y; glfwGetCursorPos(w, &x, &y); debug_input("Mouse cursor entered window: %llu at %fx%f\n", global_state.callback_os_window->id, x, y); - show_mouse_cursor(w); monotonic_t now = monotonic(); global_state.callback_os_window->last_mouse_activity_at = now; global_state.callback_os_window->mouse_x = x * global_state.callback_os_window->viewport_x_ratio; global_state.callback_os_window->mouse_y = y * global_state.callback_os_window->viewport_y_ratio; if (is_window_ready_for_callbacks()) enter_event(); + show_mouse_cursor(w); // might result in a call to cursor_pos_callback which will set callback_os_window to NULL request_tick_callback(); } else debug_input("Mouse cursor left window: %llu\n", global_state.callback_os_window->id); global_state.callback_os_window = NULL;