Cocoa: Fix unresponsive cursor after cursor warp

This is a companion to 157ebb80aa and
fixes the same issue for calls to glfwSetCursorPos.

Related to #1962

(cherry picked from commit 6ed5294223)
This commit is contained in:
Camilla Löwy
2021-09-12 17:15:59 +02:00
parent c32fefc6a0
commit 95df61e5ed
2 changed files with 9 additions and 1 deletions
+7 -1
View File
@@ -117,7 +117,8 @@ static void updateCursorMode(_GLFWwindow* window)
_glfwPlatformSetCursorPos(window,
_glfw.ns.restoreCursorPosX,
_glfw.ns.restoreCursorPosY);
CGAssociateMouseAndMouseCursorPosition(true);
// NOTE: The matching CGAssociateMouseAndMouseCursorPosition call is
// made in _glfwPlatformSetCursorPos as part of a workaround
}
if (cursorInContentArea(window))
@@ -1523,6 +1524,11 @@ void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y)
_glfwTransformYNS(globalPoint.y)));
}
// HACK: Calling this right after setting the cursor position prevents macOS
// from freezing the cursor for a fraction of a second afterwards
if (window->cursorMode != GLFW_CURSOR_DISABLED)
CGAssociateMouseAndMouseCursorPosition(true);
} // autoreleasepool
}