Android tablet support: fix Samsung DeX maximize crash, palm rejection, hardware keyboard#2
Open
howdid1gethere wants to merge 3 commits into
Open
Conversation
The DummyEdit text-input view swallowed every printing key into commitText() and returned without calling onNativeKeyDown(), so letter and number keys never reached the app as key events while text input was active (the common case in LibreSprite). This broke letter-based keyboard shortcuts -- single-key tool selectors (B, E, G, M, Z...) and combos like Ctrl+S / Ctrl+Z -- on devices with a physical keyboard. Always forward the key to SDL via onNativeKeyDown(), and only commit text for a plain printing key (no Ctrl/Alt/Meta) so normal text entry still works. This mirrors what SDLInputConnection.sendKeyEvent() already does.
Adds palm rejection so a stylus user (e.g. Samsung S-Pen) can rest their hand on the screen while drawing. The SDLSurface touch handler now reads MotionEvent.getToolType(): while a stylus is touching, or within a short window (600ms) after the most recent stylus touch/hover, finger contacts are treated as a resting palm and ignored. A hovering stylus (tracked in onGenericMotion) primes that window so a palm landing just before the pen touches down is rejected too. Finger input is unaffected when no stylus is in use.
On Samsung DeX the activity used to relaunch itself at full-display size in onCreate to open maximized. SDL2 keeps its native state in process-global singletons that cannot survive the activity being torn down and recreated, so that self-relaunch made the process exit cleanly (code 0) the instant the maximized instance came up -- what presented as the "DeX maximize crash". Remove the relaunch and rely on the AndroidManifest layout hint (defaultWidth/Height=100%) plus the expanded configChanges (screenLayout|smallestScreenSize|density|uiMode) so a single stable activity handles DeX resize in place. Also fold in the build config the default APK needs (CMAKE_POLICY_VERSION_MINIMUM=3.5 for the bundled sub-projects, swatch-file source in the native build) and tablet touch-input refinements. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Improvements to the Android port from building/testing the default APK on a Samsung Galaxy Tab S7 FE (Android 14, S Pen, DeX).
Commits
onCreateto open maximized. SDL2 keeps its native state in process-global singletons that can't survive the activity being torn down/recreated, so the relaunch made the process exit cleanly (code 0) the instant the maximized instance came up — the "DeX maximize crash". Removed the relaunch; rely on the manifest<layout defaultWidth/Height="100%">hint plus expandedconfigChanges(screenLayout|smallestScreenSize|density|uiMode) so a single stable activity handles DeX resize in place. Verified on-device: maximize now survives. Also includes the build config the default APK needs (CMAKE_POLICY_VERSION_MINIMUM=3.5for bundled sub-projects, swatch-file source wired into the native build).Testing
Built
assembleArm64Debug, installed on SM-T738U, exercised DeX maximize, S Pen drawing, and the Book Cover keyboard.🤖 Generated with Claude Code