love.visible is called when minimizing/unminimizing the window.

This commit is contained in:
Sasha Szpakowski
2024-10-19 12:33:42 -03:00
parent d3cd2aef36
commit 6e82633b56
+14 -13
View File
@@ -664,7 +664,20 @@ Message *Event::convertWindowEvent(const SDL_Event &e)
break;
case SDL_EVENT_WINDOW_SHOWN:
case SDL_EVENT_WINDOW_HIDDEN:
vargs.emplace_back(event == SDL_EVENT_WINDOW_SHOWN);
case SDL_EVENT_WINDOW_MINIMIZED:
case SDL_EVENT_WINDOW_RESTORED:
#ifdef LOVE_ANDROID
if (auto audio = Module::getInstance<audio::Audio>(Module::M_AUDIO))
{
if (event == SDL_EVENT_WINDOW_MINIMIZED)
audio->pauseContext();
else if (event == SDL_EVENT_WINDOW_RESTORED)
audio->resumeContext();
}
#endif
// WINDOW_RESTORED can also happen when going from maximized -> unmaximized,
// but there isn't a nice way to avoid sending our event in that situation.
vargs.emplace_back(event == SDL_EVENT_WINDOW_SHOWN || event == SDL_EVENT_WINDOW_RESTORED);
msg = new Message("visible", vargs);
break;
case SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED:
@@ -696,18 +709,6 @@ Message *Event::convertWindowEvent(const SDL_Event &e)
msg = new Message("resize", vargs);
}
break;
case SDL_EVENT_WINDOW_MINIMIZED:
case SDL_EVENT_WINDOW_RESTORED:
#ifdef LOVE_ANDROID
if (auto audio = Module::getInstance<audio::Audio>(Module::M_AUDIO))
{
if (event == SDL_EVENT_WINDOW_MINIMIZED)
audio->pauseContext();
else if (event == SDL_EVENT_WINDOW_RESTORED)
audio->resumeContext();
}
#endif
break;
}
return msg;