Change mute on minimize to mute on focus loss

Minimization doesn't always happen on focus loss in full-screen mode,
so it could lead to unpredictable behavior.
This commit is contained in:
Cameron Gutman
2021-01-09 17:56:23 -06:00
parent 2d62d090df
commit 7020749987
5 changed files with 26 additions and 24 deletions

View File

@@ -1345,22 +1345,19 @@ void Session::exec(int displayOriginX, int displayOriginY)
// Early handling of some events
switch (event.window.event) {
case SDL_WINDOWEVENT_FOCUS_LOST:
if (m_Preferences->muteOnFocusLoss) {
m_AudioMuted = true;
}
m_InputHandler->notifyFocusLost();
break;
case SDL_WINDOWEVENT_FOCUS_GAINED:
if (m_Preferences->muteOnFocusLoss) {
m_AudioMuted = false;
}
break;
case SDL_WINDOWEVENT_LEAVE:
m_InputHandler->notifyMouseLeave();
break;
case SDL_WINDOWEVENT_MINIMIZED:
if (m_Preferences->muteOnMinimize) {
m_AudioMuted = true;
}
break;
case SDL_WINDOWEVENT_MAXIMIZED:
case SDL_WINDOWEVENT_RESTORED:
if (m_Preferences->muteOnMinimize) {
m_AudioMuted = false;
}
break;
}
// Capture the mouse on SDL_WINDOWEVENT_ENTER if needed