-
Notifications
You must be signed in to change notification settings - Fork 2.5k
pen: Dramatic improvements to proximity information. #14487
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
base: main
Are you sure you want to change the base?
Conversation
Now everything will attempt to track pens through proximity changes (instead of removing the pen entirely). testpen.c has been updated to reflect this. Some platforms and devices are better at this than others, but this seems like a significant usability improvement across the board. Fixes libsdl-org#12992.
3b572dc to
00b233e
Compare
|
X11 confirmed, Wayland confirmed (and pen button input fixed, too). iOS didn't change in any significant way, so we'll call that confirmed. Still waiting: Windows, Emscripten, Android, macOS. |
|
Windows and Emscripten both seem to give you a new pointer ID every time you come into proximity; can't do anything with that. Allegedly WinTab can actually handle proximity, but we don't have support for it at the moment. Emscripten is probably a loss...it might make sense to just assume there's only one pen there and treat the pointer exits as proximity-outs on a single device. I don't know. |
|
It's also possible these incrementing IDs are "this is a single identifiable touch, so you can track it, and not intended to be a pen (or finger) that comes and goes." There might be a better piece of information, I'll have to check. |
|
Yeah, looks like the IDs are for a single touch (or rather, interaction, because a hovering pen that hasn't left the window or proximity will keep the same ID). Win32's GetPointerPenInfo() returns a struct with a On Windows, and Emscripten, we're just going to say there's a single pen device, like how you might have 30 USB mice plugged in but you only get events from one logical mouse. Then we can at least fake proximity, sort of. |
Not at once, but some drawing tablets support multiple pens, and drawing apps use that to automatically select the current tool. On Wacom tablets for example, the eraser end of the pen is logically a different pen, so that when you flip the pen around to use the eraser end, the drawing app automatically switches to the eraser tool. Each pen has their own current tool. |
This "fixes" proximity but limits you to a single pen device. But this is probably okay for most reasonable use cases.
Microsoft should have provided a better API. 🤷♀️
We do report if the pen is inverted (eraser side is being used). I don't have a tablet that supports this to test it myself, but the code for that is wired up for Windows. It's becoming more apparent, though, that we're going to need a WinTab code path to really get all the functionality exposed, which is super-annoying. The existing Windows code, using WM_POINTER* events, is maybe "good enough" but far from perfect. |
|
Latest commit makes all Windows pen events act like one system pen, so proximity events work more closely like you'd expect them to (but see my previous comments about adding WinTab support, which has an actual proximity event. Probably not for 3.4.0). |
Same deal as the current Windows code: this "fixes" proximity but limits you to a single pen device. But this is probably okay for most reasonable use cases.
|
Emscripten is sorted out. Moving on to Cocoa. |
|
Cocoa is good to go. I'm probably not testing Android; if it's broken, people can send a bug report. :P |
|
Docs are updated, all the builders are passing (and presumably still are passing after this documentation commit), so this can merge whenever. |
Now everything will attempt to track pens through proximity changes (instead of removing the pen entirely). testpen.c has been updated to reflect this.
Some platforms and devices are better at this than others, but this seems like a significant usability improvement across the board.
This PR has not been tested on anything but X11, do not merge yet!
Fixes #12992.