From e99b1be0234e90c34801f4fadf8a690dc6012f4d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 31 Oct 2018 08:38:50 +0530 Subject: [PATCH] macOS: Ensure stored mouse position is correct when switching to a kitty window Fixes #1103 --- glfw/cocoa_window.m | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/glfw/cocoa_window.m b/glfw/cocoa_window.m index cc5b068f4..e6399139a 100644 --- a/glfw/cocoa_window.m +++ b/glfw/cocoa_window.m @@ -455,6 +455,12 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; _glfwInputWindowFocus(window, GLFW_TRUE); updateCursorMode(window); + if (_glfw.ns.disabledCursorWindow != window && cursorInClientArea(window)) + { + double x = 0, y = 0; + _glfwPlatformGetCursorPos(window, &x, &y); + _glfwInputCursorPos(window, x, y); + } } - (void)windowDidResignKey:(NSNotification *)notification