Add being able to disable unfocus pause

It's sometimes unwanted by people, and it's unwanted enough that there
exist instructions to hexedit the binary to remove it (
https://distractionware.com/forum/index.php?topic=3247.0 ).

Fun fact, the unfocus pause didn't exist in 2.0.
This commit is contained in:
Misa
2020-06-29 19:49:14 -07:00
committed by Ethan Lee
parent 3f077ee56a
commit 35c540449e
5 changed files with 48 additions and 7 deletions

View File

@@ -244,7 +244,10 @@ void KeyPoll::Poll()
/* Window Focus */
case SDL_WINDOWEVENT_FOCUS_GAINED:
isActive = true;
if (!game.disablepause)
{
isActive = true;
}
if (!useFullscreenSpaces)
{
if (wasFullscreen)
@@ -257,14 +260,17 @@ void KeyPoll::Poll()
}
}
SDL_DisableScreenSaver();
if (Mix_PlayingMusic())
if (!game.disablepause && Mix_PlayingMusic())
{
// Correct songStart for how long we were paused
music.songStart += SDL_GetPerformanceCounter() - pauseStart;
}
break;
case SDL_WINDOWEVENT_FOCUS_LOST:
isActive = false;
if (!game.disablepause)
{
isActive = false;
}
if (!useFullscreenSpaces)
{
wasFullscreen = !graphics.screenbuffer->isWindowed;
@@ -275,7 +281,10 @@ void KeyPoll::Poll()
);
}
SDL_EnableScreenSaver();
pauseStart = SDL_GetPerformanceCounter();
if (!game.disablepause)
{
pauseStart = SDL_GetPerformanceCounter();
}
break;
/* Mouse Focus */