Skip to content

Commit

Permalink
Differentiate between Windows Ink (pen) and regular touch input
Browse files Browse the repository at this point in the history
SDL2 backport of #5926
  • Loading branch information
Susko3 authored and slouken committed Dec 17, 2023
1 parent 867d864 commit cfecc56
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/video/windows/SDL_windowsevents.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit cfecc56

Please sign in to comment.