From 7f5e7205c46a49ad3830510d095877baa9bfbc6a Mon Sep 17 00:00:00 2001 From: kimci86 Date: Tue, 15 Feb 2022 11:33:10 +0100 Subject: [PATCH] Improve scancodeToKeycode mapping --- src/SFML/Window/Unix/KeyboardImpl.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/SFML/Window/Unix/KeyboardImpl.cpp b/src/SFML/Window/Unix/KeyboardImpl.cpp index 502381fc9..f5e806ceb 100644 --- a/src/SFML/Window/Unix/KeyboardImpl.cpp +++ b/src/SFML/Window/Unix/KeyboardImpl.cpp @@ -499,7 +499,10 @@ void ensureMapping() if (keycodeToScancode[static_cast(keycode)] == sf::Keyboard::ScanUnknown) { scancode = translateKeyCode(display, static_cast(keycode)); - scancodeToKeycode[scancode] = static_cast(keycode); + + if (scancode != sf::Keyboard::ScanUnknown && scancodeToKeycode[scancode] == NullKeyCode) + scancodeToKeycode[scancode] = static_cast(keycode); + keycodeToScancode[keycode] = scancode; } }