Fixed hidden cursor positioning corner case.

This commit is contained in:
Andri Pálsson 2013-10-09 19:03:47 +02:00 committed by Camilla Berglund
parent 0e7c6e1d82
commit 99784fb8f0
3 changed files with 8 additions and 4 deletions

View File

@ -221,6 +221,8 @@ See the [GLFW documentation](http://www.glfw.org/docs/latest/).
with Xcode 5 with Xcode 5
- [Cocoa] Bugfix: Use of undeclared selectors with `@selector` caused warnings - [Cocoa] Bugfix: Use of undeclared selectors with `@selector` caused warnings
with Xcode 5 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 - [X11] Added setting of the `WM_CLASS` property to the initial window title
@ -296,6 +298,7 @@ skills.
- Pierre Moulon - Pierre Moulon
- Julian Møller - Julian Møller
- Ozzy - Ozzy
- Andri Pálsson
- Peoro - Peoro
- Braden Pellett - Braden Pellett
- Arturo J. Pérez - Arturo J. Pérez

View File

@ -1051,6 +1051,8 @@ void _glfwPlatformWaitEvents(void)
void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y) void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y)
{ {
setModeCursor(window, window->cursorMode);
if (window->monitor) if (window->monitor)
{ {
CGDisplayMoveCursorToPoint(window->monitor->ns.displayID, CGDisplayMoveCursorToPoint(window->monitor->ns.displayID,

View File

@ -35,7 +35,7 @@
// //
static void setCursorMode(_GLFWwindow* window, int newMode) static void setCursorMode(_GLFWwindow* window, int newMode)
{ {
int oldMode; const int oldMode = window->cursorMode;
if (newMode != GLFW_CURSOR_NORMAL && if (newMode != GLFW_CURSOR_NORMAL &&
newMode != GLFW_CURSOR_HIDDEN && newMode != GLFW_CURSOR_HIDDEN &&
@ -45,10 +45,11 @@ static void setCursorMode(_GLFWwindow* window, int newMode)
return; return;
} }
oldMode = window->cursorMode;
if (oldMode == newMode) if (oldMode == newMode)
return; return;
window->cursorMode = newMode;
if (window == _glfw.focusedWindow) if (window == _glfw.focusedWindow)
{ {
if (oldMode == GLFW_CURSOR_DISABLED) if (oldMode == GLFW_CURSOR_DISABLED)
@ -71,8 +72,6 @@ static void setCursorMode(_GLFWwindow* window, int newMode)
_glfwPlatformSetCursorMode(window, newMode); _glfwPlatformSetCursorMode(window, newMode);
} }
window->cursorMode = newMode;
} }
// Set sticky keys mode for the specified window // Set sticky keys mode for the specified window