mirror of
https://github.com/gwm17/glfw.git
synced 2024-11-23 02:38:52 -05:00
Decouple Win32 cursor setting and tracking
This commit is contained in:
parent
527952102a
commit
0a1225d0df
|
@ -1190,19 +1190,24 @@ void _glfwPlatformDestroyCursor(_GLFWcursor* cursor)
|
||||||
|
|
||||||
void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
|
void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
|
||||||
{
|
{
|
||||||
// It should be guaranteed that the cursor is not being used by this window if
|
POINT pos;
|
||||||
// the following condition is not met. That way it should be safe to destroy the
|
|
||||||
// cursor after calling glfwSetCursor(window, NULL) on all windows using the cursor.
|
|
||||||
|
|
||||||
if (_glfw.cursorWindow == window &&
|
if (_glfw.cursorWindow != window)
|
||||||
window->cursorMode == GLFW_CURSOR_NORMAL &&
|
return;
|
||||||
window->win32.cursorTracked)
|
|
||||||
{
|
if (window->cursorMode != GLFW_CURSOR_NORMAL)
|
||||||
if (cursor)
|
return;
|
||||||
SetCursor(cursor->win32.handle);
|
|
||||||
else
|
if (!GetCursorPos(&pos))
|
||||||
SetCursor(LoadCursorW(NULL, IDC_ARROW));
|
return;
|
||||||
}
|
|
||||||
|
if (WindowFromPoint(pos) != window->win32.handle)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (cursor)
|
||||||
|
SetCursor(cursor->win32.handle);
|
||||||
|
else
|
||||||
|
SetCursor(LoadCursorW(NULL, IDC_ARROW));
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string)
|
void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user