Simplify cursor window logic

This commit is contained in:
Camilla Berglund
2016-05-30 21:21:09 +02:00
parent 03db3ed6e9
commit 2d2756cbad
9 changed files with 104 additions and 104 deletions
+4 -3
View File
@@ -192,14 +192,15 @@ GLFWAPI void glfwSetInputMode(GLFWwindow* handle, int mode, int value)
if (window->cursorMode == value)
return;
window->cursorMode = value;
_glfwPlatformGetCursorPos(window,
&window->virtualCursorPosX,
&window->virtualCursorPosY);
if (_glfw.cursorWindow == window)
if (_glfwPlatformWindowFocused(window))
_glfwPlatformSetCursorMode(window, value);
window->cursorMode = value;
return;
}
@@ -340,7 +341,7 @@ GLFWAPI void glfwSetCursorPos(GLFWwindow* handle, double xpos, double ypos)
return;
}
if (_glfw.cursorWindow != window)
if (!_glfwPlatformWindowFocused(window))
return;
if (window->cursorMode == GLFW_CURSOR_DISABLED)