Differentiate between Windows Ink (pen) and regular touch input

SDL2 backport of https://github.com/libsdl-org/SDL/pull/5926
This commit is contained in:
Susko3 2022-07-17 16:01:03 +02:00 committed by Sam Lantinga
parent 867d8643d7
commit cfecc569b5
1 changed files with 4 additions and 1 deletions

View File

@ -99,6 +99,9 @@
#ifndef WM_GETDPISCALEDSIZE
#define WM_GETDPISCALEDSIZE 0x02E4
#endif
#ifndef TOUCHEVENTF_PEN
#define TOUCHEVENTF_PEN 0x0040
#endif
#ifndef IS_HIGH_SURROGATE
#define IS_HIGH_SURROGATE(x) (((x) >= 0xd800) && ((x) <= 0xdbff))
@ -1396,7 +1399,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
/* TODO: Can we use GetRawInputDeviceInfo and HID info to
determine if this is a direct or indirect touch device?
*/
if (SDL_AddTouch(touchId, SDL_TOUCH_DEVICE_DIRECT, "") < 0) {
if (SDL_AddTouch(touchId, SDL_TOUCH_DEVICE_DIRECT, (input->dwFlags & TOUCHEVENTF_PEN) == TOUCHEVENTF_PEN ? "pen" : "touch") < 0) {
continue;
}