Skip to content

Type in any language through a bridge keyboard - #11

Open
logicalangel wants to merge 1 commit into
harkhowalia-1:mainfrom
logicalangel:text-input
Open

logicalangel wants to merge 1 commit into
harkhowalia-1:mainfrom
logicalangel:text-input

Conversation

@logicalangel

Copy link
Copy Markdown

Typing Persian, Russian, Chinese and other non-Latin text didn't reach Android: scrcpy's INJECT_TEXT drops characters outside Android's virtual key map ("Could not inject char"). This adds an input method to the bridge, with no keys on screen, that commits what the Mac's text input produces, including composing text from Pinyin or Kana. Windows select it with ime set unless Android's on-screen keyboard is turned on. With no editor focused, keys and text still go through scrcpy, so games and shortcuts are unchanged.

Tested on LineageOS 24: Persian, English, Delete and Enter typed in Settings' search; Persian, Russian and Chinese (committed and composing) sent through the socket.

Bridge version 2. It touches AndroidDisplayView.swift next to #10; I'll rebase whichever lands second.

scrcpy's text injection only carries characters Android's virtual key map
has, so Persian, Russian, Chinese or Japanese typed on the Mac never
arrived. The bridge now has an input method (MacInputMethod) with no keys
on screen, which app windows select with `ime set` unless Android's
on-screen keyboard is turned on.

The window's view is an NSTextInputClient, so every layout, dead key and
input method works. While an editor on the window's display has input,
text, composing text (shown underlined in the app) and editing keys go to
the input method over the abstract socket msa_ime, in order; otherwise
text and keys go through scrcpy as before. Only the shell user and root
may connect to the socket, which stays up for the bridge's process since
Android recreates the service. Bridge version 2.

This branch has not been deployed

No deployments
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