Skip to content

Fix Japanese IME keys on physical keyboards - #584

Open
ah-kun wants to merge 1 commit into
ClassicOldSong:moonlight-noirfrom
ah-kun:fix/japanese-zenkaku-hankaku-key
Open

Fix Japanese IME keys on physical keyboards#584
ah-kun wants to merge 1 commit into
ClassicOldSong:moonlight-noirfrom
ah-kun:fix/japanese-zenkaku-hankaku-key

Conversation

@ah-kun

@ah-kun ah-kun commented Jul 24, 2026

Copy link
Copy Markdown

Summary

Fix Japanese IME keys when using a physical Japanese JIS keyboard
with the non-root Android client.

This adds support for:

  • Hankaku/Zenkaku
  • Henkan
  • Muhenkan
  • Katakana/Hiragana
  • Linux scan-code fallbacks for the corresponding Japanese keys

Problem

When a Japanese JIS keyboard was connected to an Android device,
normal keys and modifiers were forwarded correctly, but the
Hankaku/Zenkaku key did not affect the IME on the Windows host.

KEYCODE_ZENKAKU_HANKAKU and Linux KEY_ZENKAKUHANKAKU were not
fully mapped in the Android keyboard translation path.

In addition, Japanese IME keys could be marked as normalized.
Apollo then used its US VK-to-scan-code table, where VK_OEM_AUTO
(0xF3) maps to scan code 0x5F instead of the Japanese keyboard
scan code 0x29.

Changes

  • Map KEYCODE_ZENKAKU_HANKAKU to VK_OEM_AUTO (0xF3)
  • Map KEYCODE_HENKAN to VK_CONVERT
  • Map KEYCODE_MUHENKAN to VK_NONCONVERT
  • Map KEYCODE_KATAKANA_HIRAGANA to VK_OEM_COPY
  • Add Linux scan-code fallbacks for Japanese IME keys
  • Keep Japanese IME keys non-normalized so the host keyboard layout
    can perform the correct VK-to-scan-code conversion
  • Add unit tests for the new mappings and common keyboard keys

Testing

Tested with:

  • AQUOS R10
  • Physical Japanese JIS keyboard
  • Android non-root debug build
  • Apollo Virtual Display
  • Windows 11
  • Google Japanese Input

Verified:

  • Hankaku/Zenkaku toggles Google Japanese Input correctly
  • Regular alphanumeric keys continue to work
  • Ctrl, Alt, Meta and Tab continue to work
  • Japanese Android key-code mappings pass unit tests
  • Japanese Linux scan-code fallbacks pass unit tests

Commands:

./gradlew :app:testNonRoot_gameDebugUnitTest \
  --tests com.limelight.binding.input.KeyboardTranslatorTest

./gradlew :app:assembleNonRoot_gameDebug

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