Skip to content

Commit

Permalink
Fixed bug 2726 - WinRT touches not setting 'which' field in virtual m…
Browse files Browse the repository at this point in the history
…ouse events

This patch makes sure that any SDL_MOUSEBUTTONDOWN, SDL_MOUSEBUTTONUP, and
SDL_MOUSEMOTION events, as triggered by a touch event in a WinRT app, set the
event's 'which' field to SDL_TOUCH_MOUSEID.  Previously, this was getting set
to the same value as events from a real mouse, '0'.

Thanks to Diego for providing information on this bug, and to Tamas Hamor for
sending over a patch!
  • Loading branch information
DavidLudwig committed Nov 23, 2014
1 parent 9c39885 commit 5575948
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/video/winrt/SDL_winrtpointerinput.cpp
Expand Up @@ -233,8 +233,8 @@ void WINRT_ProcessPointerPressedEvent(SDL_Window *window, Windows::UI::Input::Po

if (!WINRT_LeftFingerDown) {
if (button) {
SDL_SendMouseMotion(window, 0, 0, (int)windowPoint.X, (int)windowPoint.Y);
SDL_SendMouseButton(window, 0, SDL_PRESSED, button);
SDL_SendMouseMotion(window, SDL_TOUCH_MOUSEID, 0, (int)windowPoint.X, (int)windowPoint.Y);
SDL_SendMouseButton(window, SDL_TOUCH_MOUSEID, SDL_PRESSED, button);
}

WINRT_LeftFingerDown = pointerPoint->PointerId;
Expand Down Expand Up @@ -264,7 +264,7 @@ WINRT_ProcessPointerMovedEvent(SDL_Window *window, Windows::UI::Input::PointerPo
SDL_SendMouseMotion(window, 0, 0, (int)windowPoint.X, (int)windowPoint.Y);
} else {
if (pointerPoint->PointerId == WINRT_LeftFingerDown) {
SDL_SendMouseMotion(window, 0, 0, (int)windowPoint.X, (int)windowPoint.Y);
SDL_SendMouseMotion(window, SDL_TOUCH_MOUSEID, 0, (int)windowPoint.X, (int)windowPoint.Y);
}

SDL_SendTouchMotion(
Expand All @@ -291,7 +291,7 @@ void WINRT_ProcessPointerReleasedEvent(SDL_Window *window, Windows::UI::Input::P

if (WINRT_LeftFingerDown == pointerPoint->PointerId) {
if (button) {
SDL_SendMouseButton(window, 0, SDL_RELEASED, button);
SDL_SendMouseButton(window, SDL_TOUCH_MOUSEID, SDL_RELEASED, button);
}
WINRT_LeftFingerDown = 0;
}
Expand Down

0 comments on commit 5575948

Please sign in to comment.