SDL_pen exists for receiving touch and stylus events. I do not receive any usable data on any of my Windows machines. I tried both Wacom and Samsung stylus devices. Both devices run Windows 11. I also tried testpen.exe, it only shows a gray window.
A brief search in the SDL3 source code shows that only WM_POINTERUPDATE is handled, the rest of the WM_POINTER events are ignored. I looked at the cocoa and wayland implementations and they call plenty of SDL_pen functions, so it appears that Windows support is not implemented yet.
I handle this in my application using SDL_SetWindowsMessageHook to catch the remaining WM_POINTER events. See the gist below as a starting point. It would be nice if the SDL_pen code would handle these Windows Ink events so that we do not need to extend SDL3 for stylus support on Windows.
https://gist.github.com/DennyLindberg/5dfff8bd132ef3ed9fab71256f144fef
I am not familiar at all with the SDL3 code standards or how SDL_pen is expected to be implemented so I do not have the the time nor ability to do a pull request right now.
Extra info related to Windows and tablets
There have been multiple ways of interacting with stylus data on Windows. Any users of Krita or similar software will recognize the two options WinTab or Windows 8+ Pointer Input (Windows Ink). WinTab is a deprecated/legacy tablet option. The WM_POINTER events were added in Windows 8. I do not think SDL3 should involve WinTab at all, unless there is a desire to support Windows prior to Windows 8.
EasyTab is a public domain header-only library for accessing WinTab. Switching between WinTab and the WM_POINTER events can be a messy deal. Most applications like Krita and Clip Studio Paint requires a restart after changing the setting.
There is also the RealTimeStylus class in RTSCom.dll, or InkCollector, for interacting with stylus data. I have never tried those. Seems like a mess. There should be no reason to touch those when the Windows Ink events give us what we need.
SDL_pen exists for receiving touch and stylus events. I do not receive any usable data on any of my Windows machines. I tried both Wacom and Samsung stylus devices. Both devices run Windows 11. I also tried
testpen.exe
, it only shows a gray window.A brief search in the SDL3 source code shows that only
WM_POINTERUPDATE
is handled, the rest of theWM_POINTER
events are ignored. I looked at the cocoa and wayland implementations and they call plenty of SDL_pen functions, so it appears that Windows support is not implemented yet.I handle this in my application using
SDL_SetWindowsMessageHook
to catch the remaining WM_POINTER events. See the gist below as a starting point. It would be nice if the SDL_pen code would handle these Windows Ink events so that we do not need to extend SDL3 for stylus support on Windows. https://gist.github.com/DennyLindberg/5dfff8bd132ef3ed9fab71256f144fefI am not familiar at all with the SDL3 code standards or how SDL_pen is expected to be implemented so I do not have the the time nor ability to do a pull request right now.
Extra info related to Windows and tablets There have been multiple ways of interacting with stylus data on Windows. Any users of Krita or similar software will recognize the two options
WinTab
orWindows 8+ Pointer Input (Windows Ink)
. WinTab is a deprecated/legacy tablet option. The WM_POINTER events were added in Windows 8. I do not think SDL3 should involve WinTab at all, unless there is a desire to support Windows prior to Windows 8.EasyTab is a public domain header-only library for accessing WinTab. Switching between WinTab and the WM_POINTER events can be a messy deal. Most applications like Krita and Clip Studio Paint requires a restart after changing the setting.
There is also the RealTimeStylus class in RTSCom.dll, or InkCollector, for interacting with stylus data. I have never tried those. Seems like a mess. There should be no reason to touch those when the Windows Ink events give us what we need.