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; } }