Skip to content

fix(gfn): align keyboard mapping with official client for non-US layouts - #547

Merged
zortos293 merged 3 commits into
devfrom
capy/fix-gfn-keyboard-non
Jun 29, 2026
Merged

fix(gfn): align keyboard mapping with official client for non-US layouts#547
zortos293 merged 3 commits into
devfrom
capy/fix-gfn-keyboard-non

Conversation

@zortos293

@zortos293 zortos293 commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

This PR aligns OpenNOW keyboard input mapping with the official GFN web client to fix keypresses on non-US keyboard layouts.

Renderer (opennow-stable/src/renderer/src/gfn/inputProtocol.ts):

  • Remove layout-dependent keyCode fallback; always prefer physical code-based VKs
  • Remove shouldUsePhysicalOemVirtualKey and physicalOemVirtualKeyCodes logic
  • Update special VK mappings: PrintScreen (0x2A), IntlRo (0xC2), IntlYen (0xC1)
  • Add missing mappings: OSLeft/Right, KanaMode, Lang1/2, Convert/NonConvert, NumpadClear

Native (native/opennow-streamer/src/input.rs, native/opennow-streamer/src/gstreamer_input.rs):

  • Add layout_mapped_keyboard_keycode mapping Set 1 scancode → official position-dependent VK
  • Apply keycode mapping before encoding Windows keyboard input
  • Scancode remains zeroed to match browser client behavior

Tests:

  • Update renderer tests to verify physical code preference for German layout
  • Add native test covering scancode→VK mapping for official position keys

Open OPE-227 OPE-227


Note

Medium Risk
Touches all keyboard input encoding for GFN (renderer + native Windows); wrong VK tables would break typing on non-US layouts but scope is limited to mapping logic with added unit tests.

Overview
Aligns GFN keyboard packets with the official web client so non-US layouts (e.g. QWERTZ) send physical key-position virtual keys with scancode 0, instead of the browser’s layout-dependent keyCode.

Renderer (inputProtocol.ts): virtualKeyFromEvent now prefers event.code → VK when available; the layout-aware OEM override (shouldUsePhysicalOemVirtualKey / physicalOemVirtualKeyCodes) is removed. Several code→VK entries are corrected or added (PrintScreen, IntlRo/Yen, OS keys, Japanese IME keys, numpad clear). Tests expect physical-code VKs on German punctuation and Y/Z swaps.

Native streamer (input.rs, gstreamer_input.rs): Windows key events run through new layout_mapped_keyboard_keycode (Set 1 scancode → official position VK, fallback to OS keycode) while scancodes stay zeroed, mirroring the browser path.

Reviewed by Cursor Bugbot for commit b306f60. Configure here.

…d VKs from official GFN client

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@zortos293 zortos293 added the capy Generated by capy.ai label Jun 29, 2026 — with Image Capy AI
@cursor

cursor Bot commented Jun 29, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_ff0cbfea-8c8c-46c7-97fc-ffade4bd0ae5)

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: fc359473-33a7-47c4-a8f7-f0f64f3c1501

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch capy/fix-gfn-keyboard-non

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b306f60be0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread native/opennow-streamer/src/input.rs Outdated
0x0042 => 0x77,
0x0043 => 0x78,
0x0044 => 0x79,
0x0045 => 0x13,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve NumLock instead of remapping raw 0x45 to Pause

In Windows native input capture, if NumLock comes from Raw Input as make_code 0x45 without RI_KEY_E0, normalize_scancode() leaves it as 0x0045; this new table then converts it to Pause (0x13) instead of preserving the incoming VK_NUMLOCK (0x90). That means native fullscreen sessions can send/toggle Pause when the user presses NumLock, so handle the 0x45 ambiguity with the fallback keycode or normalize NumLock to the existing E045 entry.

Useful? React with 👍 / 👎.

Comment on lines +304 to +306
0x0073 => 0xC2,
0x007D => 0xC1,
0x007E => 0xBC,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Add native mappings for JP language keys

This international-key section covers JP IntlRo/IntlYen, but it skips the other physical JP 106 keys whose raw scancodes are 0x70 (Hiragana/Katakana), 0x79 (Henkan/Convert), and 0x7B (Muhenkan/NonConvert). In the native path those keys fall through to Windows fallback VKs while the renderer path added the official 0xE9/0xEA/0xEB codes in this commit, so Japanese-layout users get different behavior depending on whether native input capture is active.

Useful? React with 👍 / 👎.

zortos293 and others added 2 commits June 29, 2026 19:54
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@zortos293
zortos293 merged commit 5cf3711 into dev Jun 29, 2026
16 checks passed
Chizuui pushed a commit to Chizuui/OpenNOW-Modified that referenced this pull request Aug 11, 2026
…uts (OpenCloudGaming#547)

* Fix keyboard input for non-US layouts by using physical position-based VKs from official GFN client

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* Fix native keyboard mapping edge cases

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

---------

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

capy Generated by capy.ai

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant