mirror of
https://github.com/encounter/aurora.git
synced 2026-07-09 18:19:33 -07:00
Wait until window receives focus to respect pauseOnFocusLost
This commit is contained in:
@@ -50,6 +50,7 @@ std::atomic_bool g_surfaceReady = false;
|
||||
std::atomic_bool g_surfaceReady = true;
|
||||
#endif
|
||||
bool g_lastPaused = false;
|
||||
bool g_gotFocus = false;
|
||||
|
||||
bool operator==(const AuroraWindowSize& lhs, const AuroraWindowSize& rhs) {
|
||||
return lhs.width == rhs.width && lhs.height == rhs.height && lhs.fb_width == rhs.fb_width &&
|
||||
@@ -445,6 +446,11 @@ bool is_paused() noexcept {
|
||||
if ((flags & SDL_WINDOW_HIDDEN) != 0u) {
|
||||
return true;
|
||||
}
|
||||
// Wait until the window has received focus before respecting pauseOnFocusLost
|
||||
if (!g_gotFocus) {
|
||||
g_gotFocus = (flags & SDL_WINDOW_INPUT_FOCUS) != 0u;
|
||||
return false;
|
||||
}
|
||||
return g_config.pauseOnFocusLost && ((flags & SDL_WINDOW_INPUT_FOCUS) == 0u || (flags & SDL_WINDOW_MINIMIZED) != 0u);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user