Add basic Android pen backend #11455
Open
+306
−241
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 nowSDLGenericMotionListener_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.