Fix keyboard scancode mapping for GFN input translation#301
Merged
Conversation
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>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes broken keyboard behavior across layouts by replacing the incorrect USB HID usage ID mappings with Windows Set-1 scancodes required by the GFN input protocol.
src/renderer/src/gfn/inputProtocol.ts:codeMapwith correct Windows Set-1/extended scancodes for letters (A–Z), digits, punctuation, navigation, and function keys.IntlBackslash,IntlRo,IntlYen) to support non-US layouts.mapTextCharToKeySpec) and keyboard event mapping (mapKeyboardEvent) to use the sharedcodeMap, ensuring consistent scancodes for pasted text and physical presses.NumLock,Numpad0) and modifier (e.g.,ShiftLeft/Right) scancodes to match Windows scan code set 1.src/renderer/src/gfn/webrtcClient.ts:sendAntiAfkPulse), paste shortcuts (sendPasteShortcut), and shift handling insendTextto reference the sharedcodeMapinstead of hardcoded values.Tests & Tooling:
src/renderer/src/gfn/inputProtocol.test.tswith coverage for representative keys (KeyN,KeyT,KeyZ,Escape,IntlBackslash, numpad) and verifying code-over-key precedence.tsxdependency todevDependenciesand creatednpm run testscript.