diff --git a/README.md b/README.md index 2ec37171..c44e924c 100644 --- a/README.md +++ b/README.md @@ -221,6 +221,8 @@ See the [GLFW documentation](http://www.glfw.org/docs/latest/). with Xcode 5 - [Cocoa] Bugfix: Use of undeclared selectors with `@selector` caused warnings with Xcode 5 + - [Cocoa] Bugfix: The cursor remained visible if moved onto client area after + having been set to hidden outside it - [X11] Added setting of the `WM_CLASS` property to the initial window title @@ -296,6 +298,7 @@ skills. - Pierre Moulon - Julian Møller - Ozzy + - Andri Pálsson - Peoro - Braden Pellett - Arturo J. Pérez diff --git a/src/cocoa_window.m b/src/cocoa_window.m index 85dfa636..4fd5de49 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -1051,6 +1051,8 @@ void _glfwPlatformWaitEvents(void) void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y) { + setModeCursor(window, window->cursorMode); + if (window->monitor) { CGDisplayMoveCursorToPoint(window->monitor->ns.displayID, diff --git a/src/input.c b/src/input.c index 1bd7e6d8..45fb396f 100644 --- a/src/input.c +++ b/src/input.c @@ -35,7 +35,7 @@ // static void setCursorMode(_GLFWwindow* window, int newMode) { - int oldMode; + const int oldMode = window->cursorMode; if (newMode != GLFW_CURSOR_NORMAL && newMode != GLFW_CURSOR_HIDDEN && @@ -45,10 +45,11 @@ static void setCursorMode(_GLFWwindow* window, int newMode) return; } - oldMode = window->cursorMode; if (oldMode == newMode) return; + window->cursorMode = newMode; + if (window == _glfw.focusedWindow) { if (oldMode == GLFW_CURSOR_DISABLED) @@ -71,8 +72,6 @@ static void setCursorMode(_GLFWwindow* window, int newMode) _glfwPlatformSetCursorMode(window, newMode); } - - window->cursorMode = newMode; } // Set sticky keys mode for the specified window