Pass the OS event timestamp for keyboard, mouse, and touch events where possible

Currently implemented for Windows and Apple platforms
This commit is contained in:
Sam Lantinga
2022-12-02 09:03:13 -08:00
parent 1f4cc733a1
commit 0a3262e819
62 changed files with 441 additions and 313 deletions

View File

@@ -221,12 +221,12 @@ void WINRT_ProcessPointerPressedEvent(SDL_Window *window, Windows::UI::Input::Po
Uint8 button, pressed;
WINRT_GetSDLButtonForPointerPoint(pointerPoint, &button, &pressed);
SDL_assert(pressed == 1);
SDL_SendMouseButton(window, 0, SDL_PRESSED, button);
SDL_SendMouseButton(0, window, 0, SDL_PRESSED, button);
} else {
Windows::Foundation::Point normalizedPoint = WINRT_TransformCursorPosition(window, pointerPoint->Position, NormalizeZeroToOne);
Windows::Foundation::Point windowPoint = WINRT_TransformCursorPosition(window, pointerPoint->Position, TransformToSDLWindowSize);
SDL_SendTouch(
SDL_SendTouch(0,
WINRT_TouchID,
(SDL_FingerID)pointerPoint->PointerId,
window,
@@ -250,12 +250,12 @@ void WINRT_ProcessPointerMovedEvent(SDL_Window *window, Windows::UI::Input::Poin
/* For some odd reason Moved events are used for multiple mouse buttons */
Uint8 button, pressed;
if (WINRT_GetSDLButtonForPointerPoint(pointerPoint, &button, &pressed)) {
SDL_SendMouseButton(window, 0, pressed, button);
SDL_SendMouseButton(0, window, 0, pressed, button);
}
SDL_SendMouseMotion(window, 0, 0, (int)windowPoint.X, (int)windowPoint.Y);
SDL_SendMouseMotion(0, window, 0, 0, (int)windowPoint.X, (int)windowPoint.Y);
} else {
SDL_SendTouchMotion(
SDL_SendTouchMotion(0,
WINRT_TouchID,
(SDL_FingerID)pointerPoint->PointerId,
window,
@@ -275,11 +275,11 @@ void WINRT_ProcessPointerReleasedEvent(SDL_Window *window, Windows::UI::Input::P
Uint8 button, pressed;
WINRT_GetSDLButtonForPointerPoint(pointerPoint, &button, &pressed);
SDL_assert(pressed == 0);
SDL_SendMouseButton(window, 0, SDL_RELEASED, button);
SDL_SendMouseButton(0, window, 0, SDL_RELEASED, button);
} else {
Windows::Foundation::Point normalizedPoint = WINRT_TransformCursorPosition(window, pointerPoint->Position, NormalizeZeroToOne);
SDL_SendTouch(
SDL_SendTouch(0,
WINRT_TouchID,
(SDL_FingerID)pointerPoint->PointerId,
window,
@@ -319,7 +319,7 @@ void WINRT_ProcessPointerWheelChangedEvent(SDL_Window *window, Windows::UI::Inpu
}
float motion = (float)pointerPoint->Properties->MouseWheelDelta / WHEEL_DELTA;
SDL_SendMouseWheel(window, 0, 0, (float)motion, SDL_MOUSEWHEEL_NORMAL);
SDL_SendMouseWheel(0, window, 0, 0, (float)motion, SDL_MOUSEWHEEL_NORMAL);
}
void WINRT_ProcessMouseMovedEvent(SDL_Window *window, Windows::Devices::Input::MouseEventArgs ^ args)
@@ -386,7 +386,7 @@ void WINRT_ProcessMouseMovedEvent(SDL_Window *window, Windows::Devices::Input::M
//
const Windows::Foundation::Point mouseDeltaInDIPs((float)args->MouseDelta.X, (float)args->MouseDelta.Y);
const Windows::Foundation::Point mouseDeltaInSDLWindowCoords = WINRT_TransformCursorPosition(window, mouseDeltaInDIPs, TransformToSDLWindowSize);
SDL_SendMouseMotion(
SDL_SendMouseMotion(0,
window,
0,
1,