1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-10 17:42:29 +01:00

Fix #7878: Scroll shortcut keys ignore SHIFT/CTRL/ALT modifiers

This commit is contained in:
hokasha2016
2019-05-02 15:42:05 -04:00
committed by Michael Steenbeek
parent 4746051d1b
commit 6a6465498f

View File

@@ -169,27 +169,17 @@ void KeyboardShortcuts::GetKeyboardMapScroll(const uint8_t* keysState, int32_t*
if (!keysState[scancode])
continue;
if (shortcutKey & SHIFT)
{
if (!keysState[SDL_SCANCODE_LSHIFT] && !keysState[SDL_SCANCODE_RSHIFT])
continue;
}
if (shortcutKey & CTRL)
{
if (!keysState[SDL_SCANCODE_LCTRL] && !keysState[SDL_SCANCODE_RCTRL])
continue;
}
if (shortcutKey & ALT)
{
if (!keysState[SDL_SCANCODE_LALT] && !keysState[SDL_SCANCODE_RALT])
continue;
}
// Check if SHIFT is either set in the shortcut key and currently,
// or not set in the shortcut key and not currently pressed (in other words: check if they match).
if ((bool)(shortcutKey & SHIFT) != (keysState[SDL_SCANCODE_LSHIFT] || keysState[SDL_SCANCODE_RSHIFT]))
continue;
if ((bool)(shortcutKey & CTRL) != (keysState[SDL_SCANCODE_LCTRL] || keysState[SDL_SCANCODE_RCTRL]))
continue;
if ((bool)(shortcutKey & ALT) != (keysState[SDL_SCANCODE_LALT] || keysState[SDL_SCANCODE_RALT]))
continue;
#ifdef __MACOSX__
if (shortcutKey & CMD)
{
if (!keysState[SDL_SCANCODE_LGUI] && !keysState[SDL_SCANCODE_RGUI])
continue;
}
if ((bool)(shortcutKey & CMD) != (keysState[SDL_SCANCODE_LGUI] || keysState[SDL_SCANCODE_RGUI]))
continue;
#endif
switch (shortcutId)
{