Skip to content
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

Haptic feedback support for surface pen #1205

Open
MisterE123 opened this issue Sep 3, 2024 · 2 comments
Open

Haptic feedback support for surface pen #1205

MisterE123 opened this issue Sep 3, 2024 · 2 comments
Labels
not-planned This will not be worked on Windows This issue happens on MS-Windows

Comments

@MisterE123
Copy link

Please submit only one feature request in one issue!

Is your feature request related to a problem? Please describe.
It would be great to have support for the haptic feedback for the Windows surface slim pen 2 that is used with Surface devices, like Onenote and other inking apps have.

Describe the solution you'd like
Variable pressure gives variable haptic feedback, changing tools gives momentary haptic feedback

@Doublonmousse Doublonmousse added the Windows This issue happens on MS-Windows label Sep 3, 2024
@Doublonmousse
Copy link
Collaborator

Unfortunately, I'm going to have to mark this as unplanned for now. There's way too much in the way for this to be possible right now.
Pen events have to come from the UI toolkit (right now that's gtk4). And gtk gets its events from windows ink using the (old) Win32 API.

But to have pen feedback you need to call to the WinRT API (and I'm very unsure I can call it directly outside of gtk4, I need some info on the pen itself that's probably not exposed there).
So it'd need to be supported inside gtk. However that means adding calls to WinRT in gtk4 (and on top of that exposing this feature out for us to use). And currently it's not easy to do (you probably need C++ code for this to be doable, and currently gtk is C only, and does not have WinRT calls)

Seems to be the only instance here (but in libadwaita) https://gitlab.gnome.org/GNOME/libadwaita/-/blob/main/src/adw-settings-impl-win32.c#L17
And maybe planned for gtk sometimes in the future https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/7230#note_2106464

But if/when they do, using WinRT calls in addition (or in the place of) the Win32 API to get pen events should be done first for windows. Currently

  • you don't get any information on pens when hovering (for windows ink pen), and that includes button presses. This means that pen buttons don't work the same way as on linux and the only reason this works at all on Windows is because of a workaround fix: workaround for windows ink #1113
  • there's multiple API around (wintab vs windows ink mainly) and you can't use both at the same time (and the first one doesn't work for now). So if you have a surface pen and a wacom tablet, you can't have both working (you'll lose pressure sensitivity on at least one of them)
  • you get worse resolution (1024 levels max vs the 8192 the slim pen can output)
    etc...

So the priority is to first get good support for pen (and that's at the toolkit level, be it gtk4 that we currently use, or another one if we ever decide to change). And even after that it'll only be possible if the toolkit allows you to add the feedback feature (for cross platform toolkit the priority is more a common API, and you may have ways to do more OS-specific things like the haptic feedback on windows)

@Doublonmousse
Copy link
Collaborator

If you don't want to read my (way too long) post, the TLDR is that this is not possible right now, may be in the future (with different odds depending on how things evolve) and that I'm kinda looking for what's going on in the UI toolkit world related to pen support (mainly on windows for now) so I'd update this if things do change

@Doublonmousse Doublonmousse added the not-planned This will not be worked on label Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not-planned This will not be worked on Windows This issue happens on MS-Windows
Projects
None yet
Development

No branches or pull requests

2 participants