melekor wrote on Tuesday, December 21, 2004:
glfw currently treats LOWORD(lParam) and HIWORD(lParam) as unsigned values, but this is incorrect.
Since these coordinates are relative to the window’s client area, they may be negative if cursor is above or to the left of the client rectangle.
Here is my proposed fix to win32_window.c:
case WM\_MOUSEMOVE:
\{
int NewMouseX = \(short\)LOWORD\(lParam\);
int NewMouseY = \(short\)HIWORD\(lParam\);
if\( NewMouseX \!= \_glfwInput.OldMouseX ||
NewMouseY \!= \_glfwInput.OldMouseY \)
\{
if\( \_glfwWin.MouseLock \)
\{
\_glfwInput.MousePosX += NewMouseX -
\_glfwInput.OldMouseX;
\_glfwInput.MousePosY += NewMouseY -
\_glfwInput.OldMouseY;
\}
else
\{
\_glfwInput.MousePosX = NewMouseX;
\_glfwInput.MousePosY = NewMouseY;
\}
\_glfwInput.OldMouseX = NewMouseX;
\_glfwInput.OldMouseY = NewMouseY;
\_glfwInput.MouseMoved = GL\_TRUE;
// Call user callback function
if\( \_glfwWin.MousePosCallback \)
\{
\_glfwWin.MousePosCallback\( \_glfwInput.MousePosX,
\_glfwInput.MousePosY \);
\}
\}
\}
return 0;