fix: correct ABNT2 Brazilian keyboard /? key mapping#1846
Open
aliefe04 wants to merge 1 commit intomoonlight-stream:masterfrom
Open
fix: correct ABNT2 Brazilian keyboard /? key mapping#1846aliefe04 wants to merge 1 commit intomoonlight-stream:masterfrom
aliefe04 wants to merge 1 commit intomoonlight-stream:masterfrom
Conversation
Fixes moonlight-stream#1789 On Brazilian ABNT2 keyboards, the /? key (SDL_SCANCODE_INTERNATIONAL1) was incorrectly mapped to VK_OEM_102 (backslash) instead of the correct VK_ABNT_C1. This caused the key to produce backslash/pipe instead of slash/question mark. Changes: - Add VK_ABNT_C1 (0xC1) definition for Brazilian ABNT2 keyboard - Separate SDL_SCANCODE_INTERNATIONAL1 and SDL_SCANCODE_NONUSBACKSLASH into distinct cases with correct key codes - SDL_SCANCODE_INTERNATIONAL1 now maps to VK_ABNT_C1 (/? on ABNT2) - SDL_SCANCODE_NONUSBACKSLASH still maps to VK_OEM_102 (ISO extra key) Both keys retain the SS_KBE_FLAG_NON_NORMALIZED flag to preserve layout-specific behavior.
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.
Fixes #1789
Problem
On Brazilian ABNT2 keyboards, the
/?key (SDL scancode 135 =SDL_SCANCODE_INTERNATIONAL1) was incorrectly mapped toVK_OEM_102(backslash/pipe) instead of the correctVK_ABNT_C1. This caused the key to produce\|instead of/?.Root Cause
The code was collapsing two distinct physical keys into the same Windows VK:
SDL_SCANCODE_INTERNATIONAL1(ABNT2/?key)SDL_SCANCODE_NONUSBACKSLASH(ISO extra key)Both were mapped to
VK_OEM_102via a fallthrough, which is incorrect for Brazilian ABNT2 layouts.Fix
Separate the two scancodes into distinct cases:
SDL_SCANCODE_INTERNATIONAL1→VK_ABNT_C1(0xC1) - correct for ABNT2/?keySDL_SCANCODE_NONUSBACKSLASH→VK_OEM_102(0xE2) - unchanged for ISO extra keyBoth retain the
SS_KBE_FLAG_NON_NORMALIZEDflag to preserve layout-specific behavior.Testing
Users in #1789 have confirmed:
sc073::/works, proving the scancode is correctReferences