Skip to content

Android tablet support: fix Samsung DeX maximize crash, palm rejection, hardware keyboard#2

Open
howdid1gethere wants to merge 3 commits into
LibreSprite:mainfrom
howdid1gethere:android-input-improvements
Open

Android tablet support: fix Samsung DeX maximize crash, palm rejection, hardware keyboard#2
howdid1gethere wants to merge 3 commits into
LibreSprite:mainfrom
howdid1gethere:android-input-improvements

Conversation

@howdid1gethere

Copy link
Copy Markdown

Improvements to the Android port from building/testing the default APK on a Samsung Galaxy Tab S7 FE (Android 14, S Pen, DeX).

Commits

  • Samsung DeX: open maximized without the crashing self-relaunch. 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 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 expanded configChanges (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.5 for bundled sub-projects, swatch-file source wired into the native build).
  • Add stylus palm rejection for the touch handler.
  • Deliver hardware keyboard keys to SDL so shortcuts work (Samsung Book Cover keyboard).

Testing

Built assembleArm64Debug, installed on SM-T738U, exercised DeX maximize, S Pen drawing, and the Book Cover keyboard.

🤖 Generated with Claude Code

howdid1gethere and others added 3 commits June 22, 2026 15:58
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>
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.

1 participant