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

Pen and pressure support for Windows and Android #2396

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Atilogit
Copy link

@Atilogit Atilogit commented Jul 26, 2022

  • Tested on all platforms changed
  • Added an entry to CHANGELOG.md if knowledge of this change could be valuable to users
  • Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior
  • Created or updated an example program if it would help users understand this functionality
  • 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

@madsmtm madsmtm added DS - windows DS - android C - in progress Implementation is proceeding smoothly labels Sep 2, 2022
rib added a commit to rust-mobile/android-activity that referenced this pull request Oct 22, 2022
This maintains compatibility with the `ndk` crate's `Pointer` API

Ref: rust-mobile/ndk#323

This will also be required for enabling pen pressure support to
Winit, re: rust-windowing/winit#2396
rib added a commit to rust-mobile/android-activity that referenced this pull request Oct 22, 2022
This maintains compatibility with the `ndk` crate's `Pointer` API

Ref: rust-mobile/ndk#323

This will also be required for enabling pen pressure support to
Winit, re: rust-windowing/winit#2396
rib added a commit to rust-mobile/android-activity that referenced this pull request Oct 23, 2022
This maintains compatibility with the `ndk` crate's `Pointer` API

Ref: rust-mobile/ndk#323

This will also be required for enabling pen pressure support to
Winit, re: rust-windowing/winit#2396
@DorianRudolph DorianRudolph mentioned this pull request Jan 23, 2023
5 tasks
@Doublonmousse
Copy link

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 Question: How should I call WinRT Pointer API in a desktop application? microsoft/WindowsAppSDK#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

@ActuallyHappening
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C - in progress Implementation is proceeding smoothly DS - android DS - windows
Development

Successfully merging this pull request may close these issues.

4 participants