1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-07-03 22:44:32 +00:00

fix SDL 1.2 window focus handling

This commit is contained in:
fgenesis 2019-03-24 21:15:27 +01:00
parent 0f0d839fc7
commit 6704fd1ac6
2 changed files with 25 additions and 27 deletions

View file

@ -1063,7 +1063,6 @@ void Core::run(float runTime)
{ {
if (isWindowFocus()) if (isWindowFocus())
{ {
_hasFocus = true;
if (wasInactive) if (wasInactive)
{ {
debugLog("WINDOW ACTIVE"); debugLog("WINDOW ACTIVE");
@ -1072,14 +1071,11 @@ void Core::run(float runTime)
} }
} }
else else
{
if (_hasFocus)
{ {
if (!wasInactive) if (!wasInactive)
debugLog("WINDOW INACTIVE"); debugLog("WINDOW INACTIVE");
wasInactive = true; wasInactive = true;
_hasFocus = false;
updateInputGrab(); updateInputGrab();
sound->pause(); sound->pause();
@ -1105,7 +1101,6 @@ void Core::run(float runTime)
continue; continue;
} }
} }
}
#endif #endif
old_dt = dt; old_dt = dt;

View file

@ -123,6 +123,9 @@ void Window::_onEventImpl(const SDL_Event& ev)
case SDL_VIDEORESIZE: case SDL_VIDEORESIZE:
onResize(ev.resize.w, ev.resize.h); onResize(ev.resize.w, ev.resize.h);
break; break;
case SDL_ACTIVEEVENT:
_hasFocus = ev.active.state;
} }
} }