summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTan Wang Leng <tanwangleng@outlook.com>2019-08-05 22:03:33 +0800
committerTan Wang Leng <tanwangleng@outlook.com>2019-08-05 22:10:30 +0800
commitb12240a199803c1aa08ba58e5770315f250b4d62 (patch)
tree659b3732070cd32db1b3349ff7ac53d5a4f08f20
parent834d07cfc1d61710f73a13fb72d83c48f3b4390c (diff)
Fix wrong mouse wheel position for MOUSE_MODE_CAPTURED on Windows
WM_MOUSEWHEEL and WM_MOUSEHWHEEL report mouse coordinates relative to the screen (see lParam in [1]), rather than to the window like the rest of the mouse events. The current code already makes adjustments to take that into account. However, it only makes the adjustments if the mouse is not captured, and the coordinates are always relative to the screen regardless of whether the mouse is captured or not, so let's fix the code to always consistently apply the adjustments. This fixes #29559. [1] - https://docs.microsoft.com/en-us/windows/win32/inputdev/wm-mousewheel
-rw-r--r--platform/windows/os_windows.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 07470cec92..db4575a0cb 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -719,7 +719,7 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
pressrc = 0;
}
}
- } else if (mouse_mode != MOUSE_MODE_CAPTURED) {
+ } else {
// for reasons unknown to mankind, wheel comes in screen coordinates
POINT coords;
coords.x = mb->get_position().x;