Release all keyboard keys on focus loss (fixes #1987)

This commit is contained in:
Nadia Holmquist Pedersen 2024-02-25 14:25:50 +01:00
parent 21e2a876ec
commit 67ca4997e2
3 changed files with 7 additions and 0 deletions

View File

@ -128,6 +128,11 @@ void KeyRelease(QKeyEvent* event)
KeyHotkeyMask &= ~(1<<i);
}
void KeyReleaseAll()
{
KeyInputMask = 0xFFF;
KeyHotkeyMask = 0;
}
bool JoystickButtonDown(int val)
{

View File

@ -40,6 +40,7 @@ void CloseJoystick();
void KeyPress(QKeyEvent* event);
void KeyRelease(QKeyEvent* event);
void KeyReleaseAll();
void Process();

View File

@ -916,6 +916,7 @@ void MainWindow::onAppStateChanged(Qt::ApplicationState state)
{
if (state == Qt::ApplicationInactive)
{
Input::KeyReleaseAll();
if (Config::PauseLostFocus && emuThread->emuIsRunning())
emuThread->emuPause();
}