Make right Alt key work on X11

This commit is contained in:
kimci86 2022-02-15 11:10:51 +01:00 committed by Lukas Dürrenberger
parent 39b8d67262
commit 3d62999485
2 changed files with 8 additions and 1 deletions

View File

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

View File

@ -544,9 +544,15 @@ KeyCode keyToKeyCode(sf::Keyboard::Key key)
Display* display = sf::priv::OpenDisplay();
KeyCode keycode = XKeysymToKeycode(display, keysym);
sf::priv::CloseDisplay(display);
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;
}