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

Add basic Android pen backend #11455

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

hwsmm
Copy link
Contributor

@hwsmm hwsmm commented Nov 12, 2024

Related to #10516

This PR implements Android pen backend. It is very basic because a pen I have is missing a lot of features. It only has a pen tip and a single button (no tilt support or whatever). I added some code for eraser, but I couldn't test because I don't have.

It also refactors input handling to use pointer count more extensively to reduce duplicate code, which also removes a DeX-specific workaround. I know I should have separated PRs, but this doc suggested that one shouldn't use getSource to determine whether the event came from stylus, so I ended up combining them.

ACTION_BUTTON_PRESS/ACTION_BUTTON_RELEASE doesn't seem to get triggered for stylus, so it currently compares bitflags on pen events for now.

SDLGenericMotionListener_API12 is now SDLGenericMotionListener_API14 since Android 4.0 (14) is the first version to support stylus. Current minimum API requirement is 19, so it shouldn't matter so much.

Tested on Galaxy Tab S7 FE (Android 14) with a cheap compatible pen.

@icculus
Copy link
Collaborator

icculus commented Nov 13, 2024

At first glance this looks good, but I need to look it over more carefully before merging.

@icculus icculus self-assigned this Nov 13, 2024
@icculus icculus added this to the 3.2.0 milestone Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants