-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing Pen backends #10516
Comments
PR #9938 is merging shortly, which gets the ABI handled, but these are other backends to be implemented in the future. For now I'm putting this in the 3.2.0 milestone, but any number of these backends can bump to 3.x. |
Emscripten support works as of b975bab! |
And you can see it in your browser here, if you have a pen/stylus. |
I like how the SDL types/functions in the Source Code are hyperlinks to the wiki. That's awesome :) |
I work on Drawpile and a bit on Krita and was looking at this cursorily. Unfortunately I don't have any code I can point to for reference because it's all GPL and I don't have full ownership of it, but maybe some of this experience is still helpful, so I'll just spill it here in the hopes something in there being useful. All Windows drawing applications I know of let you use both Windows Ink and Wintab because some tablets only work properly with one or the other. Windows Ink also has a bunch of undesirable behavior, like right-click emulation and weird pen feedback animations that the user has dig through several different settings apps and ancient control panel dialogs to disable. I've never heard of any drawing application using RealTimeStylus. Web browsers all use Windows Ink, for Wintab support there's only this third-party Chrome plugin. On Android, you can plug in a Wacom tablet in via USB OTG, but it doesn't work on all devices. It'll also default to a ridiculous portrait mode that only uses a fraction of the tablet surface, but the events you get are the same as with a "real" pen, so probably good enough to develop against. Also, SonarPen exists for Android and iOS, which uses a bespoke interface. I can't speak to the quality of the devices, but they've offered to send me one of their devices before and have done some legwork of their own to implement it for Krita, so you may get something out of them if you ask. There's a comment in the Emscripten implementation wondering if button 5 is really the eraser: yep, that's correct. And you don't get any information whether the pen tip or eraser tip is in use until it's pressed down, which means the application can't switch tools depending on the proximity events. Or, well, I guess in SDL's case it would be pen motion events, since the proximity events don't tell you the pen state. But may be worth pointing out this platform quirk in the documentation. From my work in implementing Emscripten tablet support in Qt, bringing the pen near the device while a touch operation is in progress implicitly cancels the touch, but you don't get any events to that effect. Unsure if this is because of how Qt deals with it or if it's the browser behaving like this, but may be something to test out. Also on Emscripten, the Apple Pencil on iPad and iPhone seems to report ridiculously low pressure values compared to other pens. I don't think there's anything SDL can really do about this except maybe document it, in Drawpile we look at the user agent and set the pressure curve to be really really steep if it smells like such a device. Wayland on Gnome and KDE has some really strange multi-cursor implementation with tablets that breaks the cursors on all Qt applications and you end up with no cursor or a default shape respectively. Not sure if SDL handles this properly or how to fix it, I just know the questions we get about it. |
For Windows 8+, you probably want win32 pointer input. I think if you try supporting pointer inputs for pens, you might be forced to use it for touch as well. |
"Win32 pointer input" is the Windows Ink I talked about in my comment. Wacom tablets and various others let you toggle it using a checkbox with that title in their driver settings. |
Initial Android support is in (thanks, @hwsmm!). |
Reference Issue libsdl-org#9911. Reference Issue libsdl-org#10516.
Windows support is in, we're good to go on all reasonable platforms now! |
Woo!! |
Can you please add wintab support for Windows too? Windows Ink is often turned off by artists because of the undesirable behaviour mentioned in #10516 (comment) |
Probably not before 3.2.0 ships, but afterwards we can. |
(I'll leave this in the milestone for now though, just in case there's a moment to get to it.) |
Reference Issue libsdl-org#9911. Reference Issue libsdl-org#10516.
Originally posted by @icculus in #9938 (comment)
The text was updated successfully, but these errors were encountered: