Consume KeyDown event if key will be consumed as a shortcut when the user releases the key
This commit is contained in:
parent
6a8500f670
commit
a7dd157f51
1 changed files with 12 additions and 0 deletions
|
@ -224,6 +224,18 @@ void inputSDLThreadRun( void )
|
|||
wlserver_unlock();
|
||||
break;
|
||||
case SDL_KEYDOWN:
|
||||
// If this keydown event is super + one of the shortcut keys, consume the keydown event, since the corresponding keyup
|
||||
// event will be consumed by the next case statement when the user releases the key
|
||||
if ( event.key.keysym.mod & KMOD_LGUI )
|
||||
{
|
||||
key = SDLScancodeToLinuxKey( event.key.keysym.scancode );
|
||||
const uint32_t shortcutKeys[] = {KEY_F, KEY_N, KEY_B, KEY_U, KEY_Y, KEY_I, KEY_O, KEY_S, KEY_G};
|
||||
const bool isShortcutKey = std::find(std::begin(shortcutKeys), std::end(shortcutKeys), key) != std::end(shortcutKeys);
|
||||
if ( isShortcutKey )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
case SDL_KEYUP:
|
||||
key = SDLScancodeToLinuxKey( event.key.keysym.scancode );
|
||||
|
||||
|
|
Loading…
Reference in a new issue