summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-11-07 15:52:20 +0100
committerGitHub <noreply@github.com>2019-11-07 15:52:20 +0100
commit6a40b6767a2c2ba0e249e34270d9604c65a54075 (patch)
tree1b9222e3f6bf730a645a0cbf94a60ec3ec469ecf
parent99cc4d246f5a9f31fa2e83ad3108013d36dc1965 (diff)
parent1c8d3ab94f130b09320584b29513790e90311b52 (diff)
Merge pull request #33423 from bruvzg/tablet_fixes
Fix graphic tablet input coordinates on Windows.
-rwxr-xr-x[-rw-r--r--]platform/windows/os_windows.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index c4cd8e068c..e73cfcf241 100644..100755
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -556,8 +556,14 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
mm->set_button_mask(last_button_state);
- mm->set_position(Vector2(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)));
- mm->set_global_position(Vector2(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)));
+ POINT coords; //client coords
+ coords.x = GET_X_LPARAM(lParam);
+ coords.y = GET_Y_LPARAM(lParam);
+
+ ScreenToClient(hWnd, &coords);
+
+ mm->set_position(Vector2(coords.x, coords.y));
+ mm->set_global_position(Vector2(coords.x, coords.y));
if (mouse_mode == MOUSE_MODE_CAPTURED) {