CursorMode DISABLED on Windows gives wrong coordinates

This commit is contained in:
Hilderin 2023-11-05 10:36:44 -05:00
parent 3eaf1255b2
commit e199152474

View File

@ -2096,20 +2096,22 @@ void _glfwPollEventsWin32(void)
} }
} }
window = _glfw.win32.disabledCursorWindow; // Fixing the problem where recentering the cursor when the mouse move breaks the lastCursorPosX and lastCursorPosY
if (window) // and the coordinates sent in _glfwInputCursorPos are completly wrong.
{ //window = _glfw.win32.disabledCursorWindow;
int width, height; //if (window)
_glfwGetWindowSizeWin32(window, &width, &height); //{
// int width, height;
// _glfwGetWindowSizeWin32(window, &width, &height);
// NOTE: Re-center the cursor only if it has moved since the last call, // // NOTE: Re-center the cursor only if it has moved since the last call,
// to avoid breaking glfwWaitEvents with WM_MOUSEMOVE // // to avoid breaking glfwWaitEvents with WM_MOUSEMOVE
if (window->win32.lastCursorPosX != width / 2 || // if (window->win32.lastCursorPosX != width / 2 ||
window->win32.lastCursorPosY != height / 2) // window->win32.lastCursorPosY != height / 2)
{ // {
_glfwSetCursorPosWin32(window, width / 2, height / 2); // _glfwSetCursorPosWin32(window, width / 2, height / 2);
} // }
} //}
} }
void _glfwWaitEventsWin32(void) void _glfwWaitEventsWin32(void)