Skip to content

android: use the native system keyboard for menu text entry - #19346

Merged
LibretroAdmin merged 1 commit into
masterfrom
android-system-input-restore
Aug 4, 2026
Merged

android: use the native system keyboard for menu text entry#19346
LibretroAdmin merged 1 commit into
masterfrom
android-system-input-restore

Conversation

@LibretroAdmin

@LibretroAdmin LibretroAdmin commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

This replaces #19126

my bad @Keropon , this was the only way I saw to still salvage the PR

Guidelines

  • Rebase before opening a pull request
  • If you are sending several unrelated fixes or features, use a branch and a separate pull request for each
  • If possible try squashing everything in a single commit. This is particularly beneficial in the case of feature merges since it allows easy bisecting when a problem arises
  • RetroArch codebase follows C89 coding rules for portability across many old platforms check using C89_BUILD=1

Description

Adds an option to use the native Android system keyboard (IME) for menu text entry instead of RetroArch's built-in on-screen keyboard, bringing Android to parity with iOS (which already swaps in the native keyboard via ios_keyboard_start()).

Why

The built-in OSK only ever receives hardware key events. On Android's NativeActivity there is no text field, so IME-committed text like clipboard paste, password-manager autofill, autocomplete, swipe, will never reach it. Pasting is therefore impossible in fields like the RetroAchievements login, menu Search, and cheat-code entry.

How it works (mirrors the existing iOS path):

  • New setting Settings → Input → "Use System Keyboard" gates the feature. Defaults OFF, so gamepad-only / no-touch devices (e.g. Android TV) keep the gamepad-navigable on-screen keyboard unless they opt in.
  • When enabled, menu_input_dialog_start() / menu_input_dialog_start_search() call a new android_keyboard_start(), placed alongside the existing #ifdef HAVE_COCOATOUCH iOS hooks.
  • RetroActivityCommon raises the soft keyboard through a hidden, focusable EditText overlay and forwards committed/pasted text back via a new onSystemKeyboardInput() JNI callback.
  • The IME runs on the Android UI thread, so text is staged under a lock and applied on the RetroArch input thread in android_keyboard_poll() (drained from android_input_poll()), then fed into the existing input_keyboard_line; The rest of the menu code is unchanged.

Scope / notes:

  • Menu OSK text entry only; in-game (core) keyboard input is untouched; Same scope as the iOS implementation.
  • Verified C89-clean on the Android NDK build (-std=gnu89 -Wdeclaration-after-statement); no new warnings introduced by the added code.

Related Issues

Related Pull Requests

None.

Reviewers

[Will update later]

Video Example

Tested on a Retroid Pocket Classic (Android 14)

screen-20260619-005333.mp4

@LibretroAdmin
LibretroAdmin merged commit 4ff6a32 into master Aug 4, 2026
91 checks passed
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