small changes to ApplicationState handling, just in case

This commit is contained in:
vitor-k 2019-09-18 15:26:38 -03:00
parent 05b1cfc63b
commit 8d8bc8fee7
2 changed files with 6 additions and 3 deletions

View file

@ -29,7 +29,7 @@
</property>
</widget>
</item>
<item>
<item>
<widget class="QCheckBox" name="toggle_background_pause">
<property name="text">
<string>Pause emulation when in background</string>

View file

@ -503,12 +503,15 @@ void GMainWindow::OnAppFocusStateChanged(Qt::ApplicationState state) {
if (!UISettings::values.pause_when_in_background) {
return;
}
if (state != Qt::ApplicationHidden && state != Qt::ApplicationInactive &&
state != Qt::ApplicationActive) {
LOG_DEBUG(Frontend, "ApplicationState unusual flag: {} ", state);
}
if (ui.action_Pause->isEnabled() &&
(state & (Qt::ApplicationHidden | Qt::ApplicationInactive))) {
auto_paused = true;
OnPauseGame();
}
if (ui.action_Start->isEnabled() && auto_paused && state == Qt::ApplicationActive) {
} else if (ui.action_Start->isEnabled() && auto_paused && state == Qt::ApplicationActive) {
auto_paused = false;
OnStartGame();
}