Skip to content

Pen and pressure support for Windows and Android - #2396

Open
Atilogit wants to merge 2 commits into
rust-windowing:masterfrom
Atilogit:master
Open

Atilogit wants to merge 2 commits into
rust-windowing:masterfrom
Atilogit:master

Conversation

@Atilogit

@Atilogit Atilogit commented Jul 26, 2022 •

Copy link
Copy Markdown
  • 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 - win32 Affects the Win32/Windows backend DS - android Affects the Android backend 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
@kchibisov kchibisov mentioned this pull request Aug 4, 2023
@Doublonmousse

Copy link
Copy Markdown

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
Copy Markdown

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

This branch has not been deployed

No deployments
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 Affects the Android backend DS - win32 Affects the Win32/Windows backend

Development

Successfully merging this pull request may close these issues.

4 participants