flxzt / rnote

Sketch and take handwritten notes.
https://rnote.flxzt.net
GNU General Public License v3.0
8.31k stars 292 forks source link

Haptic feedback support for surface pen #1205

Open MisterE123 opened 2 months ago

MisterE123 commented 2 months ago

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 commented 2 months ago

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

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 commented 2 months ago

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