Skip to content

fix: correct ABNT2 Brazilian keyboard /? key mapping#1846

Open
aliefe04 wants to merge 1 commit intomoonlight-stream:masterfrom
aliefe04:fix-abnt2-keyboard-1789
Open

fix: correct ABNT2 Brazilian keyboard /? key mapping#1846
aliefe04 wants to merge 1 commit intomoonlight-stream:masterfrom
aliefe04:fix-abnt2-keyboard-1789

Conversation

@aliefe04
Copy link
Copy Markdown

Fixes #1789

Problem

On Brazilian ABNT2 keyboards, the /? key (SDL scancode 135 = SDL_SCANCODE_INTERNATIONAL1) was incorrectly mapped to VK_OEM_102 (backslash/pipe) instead of the correct VK_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_102 via a fallthrough, which is incorrect for Brazilian ABNT2 layouts.

Fix

Separate the two scancodes into distinct cases:

  • SDL_SCANCODE_INTERNATIONAL1VK_ABNT_C1 (0xC1) - correct for ABNT2 /? key
  • SDL_SCANCODE_NONUSBACKSLASHVK_OEM_102 (0xE2) - unchanged for ISO extra key

Both retain the SS_KBE_FLAG_NON_NORMALIZED flag to preserve layout-specific behavior.

Testing

Users in #1789 have confirmed:

  1. The workaround using AutoHotKey with sc073::/ works, proving the scancode is correct
  2. The issue is specifically with Moonlight's VK mapping, not SDL or Windows

References

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.
@cgutman cgutman added this to the v6.2 milestone Apr 12, 2026
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.

The "?" "/" key from ABNT2 (Brazilian Portuguese) Keyboard is never sent from client to host (Unhandled button event: 135)

2 participants