Only trigger special key combos when all keys are up

This commit is contained in:
Cameron Gutman 2021-01-24 13:02:42 -06:00
commit 2eb4769bbc
3 changed files with 171 additions and 170 deletions

View file

@ -97,6 +97,17 @@ public:
QString getUnmappedGamepads();
private:
enum KeyCombo {
KeyComboQuit,
KeyComboUngrabInput,
KeyComboToggleFullScreen,
KeyComboToggleStatsOverlay,
KeyComboToggleMouseMode,
KeyComboToggleCursorHide,
KeyComboToggleMinimize,
KeyComboMax
};
GamepadState*
findStateForGamepad(SDL_JoystickID id);
@ -106,6 +117,8 @@ private:
void handleRelativeFingerEvent(SDL_TouchFingerEvent* event);
void performPendingSpecialKeyCombo();
static
Uint32 longPressTimerCallback(Uint32 interval, void* param);
@ -156,6 +169,14 @@ private:
QString m_OldIgnoreDevicesExcept;
bool m_CaptureSystemKeysEnabled;
struct {
KeyCombo keyCombo;
SDL_Keycode keyCode;
SDL_Scancode scanCode;
bool enabled;
} m_SpecialKeyCombos[KeyComboMax];
KeyCombo m_PendingKeyCombo;
SDL_TouchFingerEvent m_LastTouchDownEvent;
SDL_TouchFingerEvent m_LastTouchUpEvent;
SDL_TimerID m_LongPressTimer;