diff options
author | Chris Dalton <csmartdalton@google.com> | 2018-02-21 12:06:06 -0700 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-02-21 19:38:36 +0000 |
commit | 9ce9507a7f66634eeb06fc34aebdfb6c4f1a1d11 (patch) | |
tree | c81d7c76ae5ade6a7d910643e9d79cec6d3004d9 /tools/sk_app | |
parent | e4fda6c70d8a46bfb323c6921069228d583a285f (diff) |
Fix touch coordinate mapping in Windows
Coordinates were not previously being mapped correctly from screen
coordinates to window coordinates.
Bug: skia:
Change-Id: Ie56ac3b42273aede6f97ee6f83ac9766020510ea
Reviewed-on: https://skia-review.googlesource.com/109109
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Diffstat (limited to 'tools/sk_app')
-rw-r--r-- | tools/sk_app/win/Window_win.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/sk_app/win/Window_win.cpp b/tools/sk_app/win/Window_win.cpp index 10db0ec675..c442493b21 100644 --- a/tools/sk_app/win/Window_win.cpp +++ b/tools/sk_app/win/Window_win.cpp @@ -303,8 +303,8 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) std::unique_ptr<TOUCHINPUT[]> inputs(new TOUCHINPUT[numInputs]); if (GetTouchInputInfo((HTOUCHINPUT)lParam, numInputs, inputs.get(), sizeof(TOUCHINPUT))) { - RECT rect; - GetClientRect(hWnd, &rect); + POINT topLeft = {0, 0}; + ClientToScreen(hWnd, &topLeft); for (uint16_t i = 0; i < numInputs; ++i) { TOUCHINPUT ti = inputs[i]; Window::InputState state; @@ -319,8 +319,8 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) } // TOUCHINPUT coordinates are in 100ths of pixels // Adjust for that, and make them window relative - LONG tx = (ti.x / 100) - rect.left; - LONG ty = (ti.y / 100) - rect.top; + LONG tx = (ti.x / 100) - topLeft.x; + LONG ty = (ti.y / 100) - topLeft.y; eventHandled = window->onTouch(ti.dwID, state, tx, ty) || eventHandled; } } |