From fca5a8ab4895f9f1aa428130c432b60ce05f395c Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Mon, 7 Mar 2016 12:30:15 +0100 Subject: [PATCH] Fix Win32 custom cursor set for non-client area Udating the cursor via glfwSetCursor incorrectly included the non-client area of the window. --- src/win32_window.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/win32_window.c b/src/win32_window.c index 7ee1c8a1..0d0ec89f 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -1319,6 +1319,7 @@ void _glfwPlatformDestroyCursor(_GLFWcursor* cursor) void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor) { + RECT area; POINT pos; if (_glfw.cursorWindow != window) @@ -1333,6 +1334,13 @@ void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor) if (WindowFromPoint(pos) != window->win32.handle) return; + GetClientRect(window->win32.handle, &area); + ClientToScreen(window->win32.handle, (POINT*) &area.left); + ClientToScreen(window->win32.handle, (POINT*) &area.right); + + if (!PtInRect(&area, pos)) + return; + if (cursor) SetCursor(cursor->win32.handle); else