///////////////////////////////////////////////////////
| 543 | |
| 544 | //////////////////////////////////////////////////////////// |
| 545 | KeyCode keyToKeyCode(sf::Keyboard::Key key) |
| 546 | { |
| 547 | const KeySym keysym = sf::priv::keyToKeySym(key); |
| 548 | |
| 549 | if (keysym != NoSymbol) |
| 550 | { |
| 551 | const auto display = sf::priv::openDisplay(); |
| 552 | const KeyCode keycode = XKeysymToKeycode(display.get(), keysym); |
| 553 | |
| 554 | if (keycode != nullKeyCode) |
| 555 | return keycode; |
| 556 | } |
| 557 | |
| 558 | // Fallback for when XKeysymToKeycode cannot tell the KeyCode for XK_Alt_R |
| 559 | if (key == sf::Keyboard::Key::RAlt) |
| 560 | return scancodeToKeycode[sf::Keyboard::Scan::RAlt]; |
| 561 | |
| 562 | return nullKeyCode; |
| 563 | } |
| 564 | |
| 565 | |
| 566 | //////////////////////////////////////////////////////////// |
no test coverage detected