Skip to content

Android: "Use System Keyboard" opt-in#19126

Open
Keropon wants to merge 1 commit into
libretro:masterfrom
Keropon:android-system-input
Open

Android: "Use System Keyboard" opt-in#19126
Keropon wants to merge 1 commit into
libretro:masterfrom
Keropon:android-system-input

Conversation

@Keropon

@Keropon Keropon commented Jun 21, 2026

Copy link
Copy Markdown

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

@i30817

i30817 commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Copy paste and speech to text should be helpful

Google keyboards and replacements are not full keyboard replacements. But then again neither is the libretro onscreen keyboard, so that doesn't matter.

I sometimes wish I could use it like in termux for text only dos, scummvm games and similar, but those cores have their own replacements even if they're inferior in usability, or assume a real keyboard. No reason to hold up a frontend keyboard because of a wish of being able to use it in cores that would probably look bad anyway with the keyboard replacing most of the screen of a game when in use. But of you have a idea for it I wouldn't say no...

Speech to text if it could be made "minimal" could be pretty cool in games like the older text only adventures.

@Keropon Keropon changed the title Android Input Initial commit Android: "Use System Keyboard" opt-in Jun 26, 2026
@Keropon Keropon marked this pull request as ready for review June 26, 2026 05:16
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