winit icon indicating copy to clipboard operation
winit copied to clipboard

Pen and pressure support for Windows and Android

Open Atilogit opened this issue 3 years ago • 2 comments

  • [x] Tested on all platforms changed
  • [x] Added an entry to CHANGELOG.md if knowledge of this change could be valuable to users
  • [x] Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior
  • [x] Created or updated an example program if it would help users understand this functionality
  • [x] Updated feature matrix, if new features were added or implemented

About the TODO for getToolType:

My PR for the ndk repo #323 needs to go through before this can be implemented. Using the event source worked reliably on my devices so this workaround should be good for now.

This relates to #99

Atilogit avatar Jul 26 '22 03:07 Atilogit

I think this functionality would greatly benefit from the use of WinRT either as a supplement of the Win32 calls on Windows to get the pen information or to replace them completely (keeping potentially both with conditional flags for different windows version if version compatibility is too much of an issue otherwise).

Indeed on Windows :

  • Pen pressure is limited to 1024 levels with Win32, not with WinRT (returns a f32 with a precision that can be larger, 4096 levels between 0 and 1 if the pen supports it)
  • Better support for the barrel button/side buttons. With the Win32 API, no information is available on the status of the pen when it's hovering (unlike linux). With the WinRT API, this information is always available, when the pen is hovering or on the surface. This also means a better support/user experience overall for pens over Win32 (see the issue here https://github.com/microsoft/WindowsAppSDK/issues/233 for reference)
  • there are other API/events sent by WinRT over Win32: event for undocking the pen, and haptic feedback but I guess it's way less interesting to support (and probably very windows specific)

I'm testing these changes (POC at this point, I'm only printing out the info) here : https://github.com/Doublonmousse/winit/tree/winit-pen

Doublonmousse avatar May 22 '24 19:05 Doublonmousse

Note: This does not implement the double tap functionality of Apple Pens

ActuallyHappening avatar Jun 25 '24 13:06 ActuallyHappening