Skip to content

Commit

Permalink
love.visible is called when minimizing/unminimizing the window.
Browse files Browse the repository at this point in the history
  • Loading branch information
slime73 committed Oct 19, 2024
1 parent d3cd2ae commit 6e82633
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions src/modules/event/sdl/Event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 6e82633

Please sign in to comment.