From cfecc569b5f0a6efae4b97eb6b6449031d62e27e Mon Sep 17 00:00:00 2001 From: Susko3 Date: Sun, 17 Jul 2022 16:01:03 +0200 Subject: [PATCH] Differentiate between Windows Ink (pen) and regular touch input SDL2 backport of https://github.com/libsdl-org/SDL/pull/5926 --- src/video/windows/SDL_windowsevents.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c index db9776e3e..cbb51b659 100644 --- a/src/video/windows/SDL_windowsevents.c +++ b/src/video/windows/SDL_windowsevents.c @@ -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; }