Refactor cursor mode paths

This is the refactoring part of adding GLFW_CURSOR_CAPTURED, separated
out to help keep 3.3-stable similar to the main branch.

Related to #58.

(cherry picked from commit a46f829de8)
This commit is contained in:
Camilla Löwy
2019-07-08 14:45:31 +02:00
parent 632d35e0d4
commit 5f3e5542cf
4 changed files with 120 additions and 43 deletions
+6 -2
View File
@@ -2527,7 +2527,8 @@ void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
if (!window->wl.lockedPointer)
lockPointer(window);
}
else
else if (window->cursorMode == GLFW_CURSOR_NORMAL ||
window->cursorMode == GLFW_CURSOR_HIDDEN)
{
if (window->wl.lockedPointer)
unlockPointer(window);
@@ -2568,8 +2569,11 @@ void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
setCursorImage(window, &cursorWayland);
}
}
else
else if (window->cursorMode == GLFW_CURSOR_HIDDEN ||
window->cursorMode == GLFW_CURSOR_DISABLED)
{
wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerEnterSerial, NULL, 0, 0);
}
}
static void dataSourceHandleTarget(void* userData,