Improve scancodeToKeycode mapping

This commit is contained in:
kimci86 2022-02-15 11:33:10 +01:00 committed by Lukas Dürrenberger
parent 3d62999485
commit 7f5e7205c4

View File

@ -499,7 +499,10 @@ void ensureMapping()
if (keycodeToScancode[static_cast<KeyCode>(keycode)] == sf::Keyboard::ScanUnknown) if (keycodeToScancode[static_cast<KeyCode>(keycode)] == sf::Keyboard::ScanUnknown)
{ {
scancode = translateKeyCode(display, static_cast<KeyCode>(keycode)); scancode = translateKeyCode(display, static_cast<KeyCode>(keycode));
if (scancode != sf::Keyboard::ScanUnknown && scancodeToKeycode[scancode] == NullKeyCode)
scancodeToKeycode[scancode] = static_cast<KeyCode>(keycode); scancodeToKeycode[scancode] = static_cast<KeyCode>(keycode);
keycodeToScancode[keycode] = scancode; keycodeToScancode[keycode] = scancode;
} }
} }