diff --git a/src/SFML/Window/Unix/KeySymToKeyMapping.cpp b/src/SFML/Window/Unix/KeySymToKeyMapping.cpp index 7aea2d979..f9e4264e1 100644 --- a/src/SFML/Window/Unix/KeySymToKeyMapping.cpp +++ b/src/SFML/Window/Unix/KeySymToKeyMapping.cpp @@ -43,6 +43,7 @@ Keyboard::Key keySymToKey(KeySym symbol) case XK_Control_L: return Keyboard::LControl; case XK_Control_R: return Keyboard::RControl; case XK_Alt_L: return Keyboard::LAlt; + case XK_ISO_Level3_Shift: case XK_Alt_R: return Keyboard::RAlt; case XK_Super_L: return Keyboard::LSystem; case XK_Super_R: return Keyboard::RSystem; diff --git a/src/SFML/Window/Unix/KeyboardImpl.cpp b/src/SFML/Window/Unix/KeyboardImpl.cpp index cf53f9484..502381fc9 100644 --- a/src/SFML/Window/Unix/KeyboardImpl.cpp +++ b/src/SFML/Window/Unix/KeyboardImpl.cpp @@ -544,9 +544,15 @@ KeyCode keyToKeyCode(sf::Keyboard::Key key) Display* display = sf::priv::OpenDisplay(); KeyCode keycode = XKeysymToKeycode(display, keysym); sf::priv::CloseDisplay(display); - return keycode; + + if (keycode != NullKeyCode) + return keycode; } + // Fallback for when XKeysymToKeycode cannot tell the KeyCode for XK_Alt_R + if (key == sf::Keyboard::RAlt) + return scancodeToKeycode[sf::Keyboard::ScanRAlt]; + return NullKeyCode; }