summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2016-07-21 17:31:24 +0200
committerGitHub <noreply@github.com>2016-07-21 17:31:24 +0200
commitb623acb718c50b86219027e0f6f7bebd11d96909 (patch)
tree5bd1a9efd840c0399e6cd2177c35f9c392848a3e
parent93de25f68a6b277293c0d3476996ab074ba3dc16 (diff)
parentf4c0bc20c3052533a44533dc85a0576d0ecc140d (diff)
Merge pull request #5841 from vnen/fix-windows-wheel
Fix mouse wheel event position on Windows
-rw-r--r--platform/windows/os_windows.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index c73e66f2b2..6aee0d2399 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -581,11 +581,14 @@ LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) {
}
} else if (mouse_mode!=MOUSE_MODE_CAPTURED) {
// for reasons unknown to mankind, wheel comes in screen cordinates
- RECT rect;
- GetWindowRect(hWnd,&rect);
- mb.x-=rect.left;
- mb.y-=rect.top;
+ POINT coords;
+ coords.x = mb.x;
+ coords.y = mb.y;
+ ScreenToClient(hWnd, &coords);
+
+ mb.x = coords.x;
+ mb.y = coords.y;
}
if (main_loop) {