mirror of
https://github.com/Ryujinx/SDL.git
synced 2024-12-24 02:15:36 +00:00
WinRT: fixed two bugs regarding mouse events
The first bug had mouse motion events not getting sent out on non-touch devices, if and when a mouse button wasn't pressed. The second bug caused virtual mouse motion events to get sent out-of-order on touch devices: the motion event would get sent after the touch occurred, rather than before.
This commit is contained in:
parent
62c781eaff
commit
e64e3d8c27
|
@ -209,20 +209,20 @@ void WINRT_ProcessPointerPressedEvent(SDL_Window *window, Windows::UI::Input::Po
|
||||||
}
|
}
|
||||||
|
|
||||||
Windows::Foundation::Point transformedPoint = WINRT_TransformCursorPosition(window, pointerPoint->Position);
|
Windows::Foundation::Point transformedPoint = WINRT_TransformCursorPosition(window, pointerPoint->Position);
|
||||||
|
|
||||||
if (!WINRT_LeftFingerDown) {
|
|
||||||
Uint8 button = WINRT_GetSDLButtonForPointerPoint(pointerPoint);
|
Uint8 button = WINRT_GetSDLButtonForPointerPoint(pointerPoint);
|
||||||
|
|
||||||
|
if (!WINRT_IsTouchEvent(pointerPoint)) {
|
||||||
|
SDL_SendMouseButton(window, 0, SDL_PRESSED, button);
|
||||||
|
} else {
|
||||||
|
if (!WINRT_LeftFingerDown) {
|
||||||
if (button) {
|
if (button) {
|
||||||
#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
|
|
||||||
SDL_SendMouseMotion(window, 0, 0, (int)transformedPoint.X, (int)transformedPoint.Y);
|
SDL_SendMouseMotion(window, 0, 0, (int)transformedPoint.X, (int)transformedPoint.Y);
|
||||||
#endif
|
|
||||||
SDL_SendMouseButton(window, 0, SDL_PRESSED, button);
|
SDL_SendMouseButton(window, 0, SDL_PRESSED, button);
|
||||||
}
|
}
|
||||||
|
|
||||||
WINRT_LeftFingerDown = pointerPoint->PointerId;
|
WINRT_LeftFingerDown = pointerPoint->PointerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WINRT_IsTouchEvent(pointerPoint)) {
|
|
||||||
SDL_SendTouch(
|
SDL_SendTouch(
|
||||||
WINRT_TouchID,
|
WINRT_TouchID,
|
||||||
(SDL_FingerID) pointerPoint->PointerId,
|
(SDL_FingerID) pointerPoint->PointerId,
|
||||||
|
@ -242,11 +242,13 @@ WINRT_ProcessPointerMovedEvent(SDL_Window *window, Windows::UI::Input::PointerPo
|
||||||
|
|
||||||
Windows::Foundation::Point transformedPoint = WINRT_TransformCursorPosition(window, pointerPoint->Position);
|
Windows::Foundation::Point transformedPoint = WINRT_TransformCursorPosition(window, pointerPoint->Position);
|
||||||
|
|
||||||
|
if (!WINRT_IsTouchEvent(pointerPoint)) {
|
||||||
|
SDL_SendMouseMotion(window, 0, 0, (int)transformedPoint.X, (int)transformedPoint.Y);
|
||||||
|
} else if (pointerPoint->PointerId == WINRT_LeftFingerDown) {
|
||||||
if (pointerPoint->PointerId == WINRT_LeftFingerDown) {
|
if (pointerPoint->PointerId == WINRT_LeftFingerDown) {
|
||||||
SDL_SendMouseMotion(window, 0, 0, (int)transformedPoint.X, (int)transformedPoint.Y);
|
SDL_SendMouseMotion(window, 0, 0, (int)transformedPoint.X, (int)transformedPoint.Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WINRT_IsTouchEvent(pointerPoint)) {
|
|
||||||
SDL_SendTouchMotion(
|
SDL_SendTouchMotion(
|
||||||
WINRT_TouchID,
|
WINRT_TouchID,
|
||||||
(SDL_FingerID) pointerPoint->PointerId,
|
(SDL_FingerID) pointerPoint->PointerId,
|
||||||
|
@ -263,16 +265,18 @@ void WINRT_ProcessPointerReleasedEvent(SDL_Window *window, Windows::UI::Input::P
|
||||||
}
|
}
|
||||||
|
|
||||||
Windows::Foundation::Point transformedPoint = WINRT_TransformCursorPosition(window, pointerPoint->Position);
|
Windows::Foundation::Point transformedPoint = WINRT_TransformCursorPosition(window, pointerPoint->Position);
|
||||||
|
|
||||||
if (WINRT_LeftFingerDown == pointerPoint->PointerId) {
|
|
||||||
Uint8 button = WINRT_GetSDLButtonForPointerPoint(pointerPoint);
|
Uint8 button = WINRT_GetSDLButtonForPointerPoint(pointerPoint);
|
||||||
|
|
||||||
|
if (!WINRT_IsTouchEvent(pointerPoint)) {
|
||||||
|
SDL_SendMouseButton(window, 0, SDL_RELEASED, button);
|
||||||
|
} else {
|
||||||
|
if (WINRT_LeftFingerDown == pointerPoint->PointerId) {
|
||||||
if (button) {
|
if (button) {
|
||||||
SDL_SendMouseButton(window, 0, SDL_RELEASED, button);
|
SDL_SendMouseButton(window, 0, SDL_RELEASED, button);
|
||||||
}
|
}
|
||||||
WINRT_LeftFingerDown = 0;
|
WINRT_LeftFingerDown = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WINRT_IsTouchEvent(pointerPoint)) {
|
|
||||||
SDL_SendTouch(
|
SDL_SendTouch(
|
||||||
WINRT_TouchID,
|
WINRT_TouchID,
|
||||||
(SDL_FingerID) pointerPoint->PointerId,
|
(SDL_FingerID) pointerPoint->PointerId,
|
||||||
|
|
Loading…
Reference in a new issue