From a55c3f48eb3bf82642694da75538a419ac9668b3 Mon Sep 17 00:00:00 2001 From: Niklas Behrens Date: Sun, 7 Jul 2013 22:05:29 +0200 Subject: [PATCH] Fix incorrect cursor position When reactivating the cursor its position was updated visually but not internally which caused glfwGetCursorPos to return wrong values. --- src/input.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/input.c b/src/input.c index c415462e..de4ed793 100644 --- a/src/input.c +++ b/src/input.c @@ -55,7 +55,12 @@ static void setCursorMode(_GLFWwindow* window, int newMode) if (window == _glfw.focusedWindow) { if (oldMode == GLFW_CURSOR_DISABLED) + { + window->cursorPosX = _glfw.cursorPosX; + window->cursorPosY = _glfw.cursorPosY; + _glfwPlatformSetCursorPos(window, _glfw.cursorPosX, _glfw.cursorPosY); + } else if (newMode == GLFW_CURSOR_DISABLED) { int width, height;