From 157ebb80aafe263b86fd450f21a193f0412fb717 Mon Sep 17 00:00:00 2001 From: Ioannis Tsakpinis Date: Sun, 5 Sep 2021 22:58:53 +0300 Subject: [PATCH] Cocoa: Fix unresponsive cursor after ungrab There is a suppression interval (0.25 seconds by default) after a call to CGWarpMouseCursorPosition, during which local hardware events (keyboard and mouse) are ignored. GLFW already calls CGEventSourceSetLocalEventsSuppressionInterval with a value of 0.0, but it doesn't help in this case, there is still a short delay before the cursor can be moved. Moving the CGAssociateMouseAndMouseCursorPosition call after the cursor position has been restored, fixes the issue. Closes #1962 --- src/cocoa_window.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cocoa_window.m b/src/cocoa_window.m index 6ab0ffa6..9408e572 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -114,10 +114,10 @@ static void updateCursorMode(_GLFWwindow* window) else if (_glfw.ns.disabledCursorWindow == window) { _glfw.ns.disabledCursorWindow = NULL; - CGAssociateMouseAndMouseCursorPosition(true); _glfwPlatformSetCursorPos(window, _glfw.ns.restoreCursorPosX, _glfw.ns.restoreCursorPosY); + CGAssociateMouseAndMouseCursorPosition(true); } if (cursorInContentArea(window))