https://github.com/libsdl-org/SDL/commit/3c29b620e4b719a33c0d0f21d621a8ec4e8998f7
From 3c29b620e4b719a33c0d0f21d621a8ec4e8998f7 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 30 Apr 2025 10:20:56 -0700
Subject: [PATCH] Fixed missing simulated mouse events using a Wacom tablet
The low 16-bits of the message extra info is an event sequence number when using the Wacom tablet with Windows Ink disabled. The high bits of normal mouse motion when using touch input match the touch signature, 0xFF515700. The high bits of raw input mouse motion when using touch input do not match that signature, so we have to check for the touch bit in that case.
Fixes https://github.com/libsdl-org/SDL/issues/12927
(cherry picked from commit 106ccc722edd4d7ea0d488b42f30fd8a1d821ccd)
---
src/video/windows/SDL_windowsevents.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c
index f6060c17a624f..ffddc6035ecf5 100644
--- a/src/video/windows/SDL_windowsevents.c
+++ b/src/video/windows/SDL_windowsevents.c
@@ -473,11 +473,6 @@ static SDL_MOUSE_EVENT_SOURCE GetMouseMessageSource(ULONG extrainfo)
return SDL_MOUSE_EVENT_SOURCE_PEN;
}
}
- /* Sometimes WM_INPUT events won't have the correct touch signature,
- so we have to rely purely on the touch bit being set. */
- if (SDL_TouchDevicesAvailable() && extrainfo & 0x80) {
- return SDL_MOUSE_EVENT_SOURCE_TOUCH;
- }
return SDL_MOUSE_EVENT_SOURCE_MOUSE;
}
#endif // !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
@@ -615,7 +610,8 @@ static void WIN_HandleRawMouseInput(Uint64 timestamp, SDL_VideoData *data, HANDL
return;
}
- if (GetMouseMessageSource(rawmouse->ulExtraInformation) != SDL_MOUSE_EVENT_SOURCE_MOUSE) {
+ if (GetMouseMessageSource(rawmouse->ulExtraInformation) != SDL_MOUSE_EVENT_SOURCE_MOUSE ||
+ (SDL_TouchDevicesAvailable() && (rawmouse->ulExtraInformation & 0x80) == 0x80)) {
return;
}