From e1991524742b874b1ebd9f826026caae406e1778 Mon Sep 17 00:00:00 2001 From: Hilderin <81109165+Hilderin@users.noreply.github.com> Date: Sun, 5 Nov 2023 10:36:44 -0500 Subject: [PATCH] CursorMode DISABLED on Windows gives wrong coordinates --- src/win32_window.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/win32_window.c b/src/win32_window.c index 676640bf..10f144b2 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -2096,20 +2096,22 @@ void _glfwPollEventsWin32(void) } } - window = _glfw.win32.disabledCursorWindow; - if (window) - { - int width, height; - _glfwGetWindowSizeWin32(window, &width, &height); + // Fixing the problem where recentering the cursor when the mouse move breaks the lastCursorPosX and lastCursorPosY + // and the coordinates sent in _glfwInputCursorPos are completly wrong. + //window = _glfw.win32.disabledCursorWindow; + //if (window) + //{ + // int width, height; + // _glfwGetWindowSizeWin32(window, &width, &height); - // NOTE: Re-center the cursor only if it has moved since the last call, - // to avoid breaking glfwWaitEvents with WM_MOUSEMOVE - if (window->win32.lastCursorPosX != width / 2 || - window->win32.lastCursorPosY != height / 2) - { - _glfwSetCursorPosWin32(window, width / 2, height / 2); - } - } + // // NOTE: Re-center the cursor only if it has moved since the last call, + // // to avoid breaking glfwWaitEvents with WM_MOUSEMOVE + // if (window->win32.lastCursorPosX != width / 2 || + // window->win32.lastCursorPosY != height / 2) + // { + // _glfwSetCursorPosWin32(window, width / 2, height / 2); + // } + //} } void _glfwWaitEventsWin32(void)