fix(win/input): use active keyboard layout for non-normalized key events (#3125)
Some checks are pending
CI / GitHub Env Debug (push) Waiting to run
CI / Setup Release (push) Waiting to run
CI / Setup Flatpak Matrix (push) Waiting to run
CI / Linux Flatpak (push) Blocked by required conditions
CI / Linux ${{ matrix.type }} (--appimage-build, 22.04, AppImage) (push) Blocked by required conditions
CI / Homebrew (${{ matrix.os_name }}-${{ matrix.os_version }}${{ matrix.release == true && ' (Release)' || '' }}) (macos, 12) (push) Blocked by required conditions
CI / Homebrew (${{ matrix.os_name }}-${{ matrix.os_version }}${{ matrix.release == true && ' (Release)' || '' }}) (macos, 13) (push) Blocked by required conditions
CI / Homebrew (${{ matrix.os_name }}-${{ matrix.os_version }}${{ matrix.release == true && ' (Release)' || '' }}) (macos, 14) (push) Blocked by required conditions
CI / Homebrew (${{ matrix.os_name }}-${{ matrix.os_version }}${{ matrix.release == true && ' (Release)' || '' }}) (ubuntu, latest) (push) Blocked by required conditions
CI / Homebrew (${{ matrix.os_name }}-${{ matrix.os_version }}${{ matrix.release == true && ' (Release)' || '' }}) (ubuntu, latest, true) (push) Blocked by required conditions
CI / Macports (macOS-${{ matrix.os_version }}) (12, true) (push) Blocked by required conditions
CI / Macports (macOS-${{ matrix.os_version }}) (13) (push) Blocked by required conditions
CI / Macports (macOS-${{ matrix.os_version }}) (14) (push) Blocked by required conditions
CI / Windows (push) Blocked by required conditions
CI Docker / Check Dockerfiles (push) Waiting to run
CI Docker / Setup Release (push) Blocked by required conditions
CI Docker / Docker${{ matrix.tag }} (push) Blocked by required conditions
CodeQL / Get language matrix (push) Waiting to run
CodeQL / Analyze (${{ matrix.name }}) (push) Blocked by required conditions
localize / Update Localization (push) Waiting to run
Build GH-Pages / update_pages (push) Waiting to run

This commit is contained in:
Cameron Gutman 2024-09-04 22:25:02 -05:00 committed by GitHub
parent dce250d62d
commit 49319d7688
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -618,12 +618,16 @@ namespace platf {
auto &ki = i.ki;
// If the client did not normalize this VK code to a US English layout, we can't accurately convert it to a scancode.
bool send_scancode = !(flags & SS_KBE_FLAG_NON_NORMALIZED) || config::input.always_send_scancodes;
if (send_scancode) {
// If we're set to always send scancodes, we will use the current keyboard layout to convert to a scancode. This will
// assume the client and host have the same keyboard layout, but it's probably better than always using US English.
if (!(flags & SS_KBE_FLAG_NON_NORMALIZED)) {
// Mask off the extended key byte
ki.wScan = VK_TO_SCANCODE_MAP[modcode & 0xFF];
}
else if (config::input.always_send_scancodes && modcode != VK_LWIN && modcode != VK_RWIN && modcode != VK_PAUSE) {
// For some reason, MapVirtualKey(VK_LWIN, MAPVK_VK_TO_VSC) doesn't seem to work :/
ki.wScan = MapVirtualKey(modcode, MAPVK_VK_TO_VSC);
}
// If we can map this to a scancode, send it as a scancode for maximum game compatibility.
if (ki.wScan) {