1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-27 22:49:25 +02:00

Added option to configure key modifiers (Alt, Shift, Ctrl). Fixes lobby

hotkey activation.
This commit is contained in:
Ivan Savenko
2024-05-07 08:55:41 +00:00
parent 4949b98ed3
commit ffc207888b
3 changed files with 22 additions and 1 deletions

View File

@@ -32,9 +32,24 @@ InputSourceKeyboard::InputSourceKeyboard()
#endif
}
std::string InputSourceKeyboard::getKeyNameWithModifiers(const std::string & keyName) const
{
std::string result;
if (isKeyboardCtrlDown())
result += "Ctrl+";
if (isKeyboardAltDown())
result += "Alt+";
if (isKeyboardShiftDown())
result += "Shift+";
result += keyName;
return result;
}
void InputSourceKeyboard::handleEventKeyDown(const SDL_KeyboardEvent & key)
{
std::string keyName = SDL_GetKeyName(key.keysym.sym);
std::string keyName = getKeyNameWithModifiers(SDL_GetKeyName(key.keysym.sym));
logGlobal->trace("keyboard: key '%s' pressed", keyName);
assert(key.state == SDL_PRESSED);