diff options
author | Nadia Holmquist Pedersen <nadia@nhp.sh> | 2024-02-25 14:25:50 +0100 |
---|---|---|
committer | Nadia Holmquist Pedersen <nadia@nhp.sh> | 2024-02-25 14:25:50 +0100 |
commit | 67ca4997e22cd88e349ecffd2cd388431dcc8de3 (patch) | |
tree | 4d36e4571751b8dd54aa443eb90c949640767e89 | |
parent | 21e2a876ec7392eb3d8d2c4d0f0aee5cd9a298f0 (diff) |
Release all keyboard keys on focus loss (fixes #1987)
-rw-r--r-- | src/frontend/qt_sdl/Input.cpp | 5 | ||||
-rw-r--r-- | src/frontend/qt_sdl/Input.h | 1 | ||||
-rw-r--r-- | src/frontend/qt_sdl/Window.cpp | 1 |
3 files changed, 7 insertions, 0 deletions
diff --git a/src/frontend/qt_sdl/Input.cpp b/src/frontend/qt_sdl/Input.cpp index c429cd3..27c42e9 100644 --- a/src/frontend/qt_sdl/Input.cpp +++ b/src/frontend/qt_sdl/Input.cpp @@ -128,6 +128,11 @@ void KeyRelease(QKeyEvent* event) KeyHotkeyMask &= ~(1<<i); } +void KeyReleaseAll() +{ + KeyInputMask = 0xFFF; + KeyHotkeyMask = 0; +} bool JoystickButtonDown(int val) { diff --git a/src/frontend/qt_sdl/Input.h b/src/frontend/qt_sdl/Input.h index 2dfa4a7..5a38756 100644 --- a/src/frontend/qt_sdl/Input.h +++ b/src/frontend/qt_sdl/Input.h @@ -40,6 +40,7 @@ void CloseJoystick(); void KeyPress(QKeyEvent* event); void KeyRelease(QKeyEvent* event); +void KeyReleaseAll(); void Process(); diff --git a/src/frontend/qt_sdl/Window.cpp b/src/frontend/qt_sdl/Window.cpp index 0f0b71f..fde29b6 100644 --- a/src/frontend/qt_sdl/Window.cpp +++ b/src/frontend/qt_sdl/Window.cpp @@ -916,6 +916,7 @@ void MainWindow::onAppStateChanged(Qt::ApplicationState state) { if (state == Qt::ApplicationInactive) { + Input::KeyReleaseAll(); if (Config::PauseLostFocus && emuThread->emuIsRunning()) emuThread->emuPause(); } |