Fix pause when inactive for new wxWidgets

Handle the Iconize event to pause when "pause when inactive" is enabled,
to work around a change in recent versions of wxWidgets that ignore this
unfocus event.

Fix #1494.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover
2025-10-01 17:05:39 +00:00
parent ed1b7ff47c
commit 68e7d98b85
2 changed files with 14 additions and 0 deletions

View File

@@ -985,6 +985,7 @@ EVT_MOVE(MainFrame::OnMove)
EVT_MOVE_START(MainFrame::OnMoveStart)
EVT_MOVE_END(MainFrame::OnMoveEnd)
EVT_SIZE(MainFrame::OnSize)
EVT_ICONIZE(MainFrame::OnIconize)
#if defined(__WXMSW__)
@@ -1088,6 +1089,17 @@ void MainFrame::OnSize(wxSizeEvent& event)
OPTION(kGeomFullScreen) = IsFullScreen();
}
void MainFrame::OnIconize(wxIconizeEvent& event)
{
if (!init_complete_) {
return;
}
if (OPTION(kPrefPauseWhenInactive)) {
panel->Pause();
}
}
wxString MainFrame::GetGamePath(wxString path)
{
wxString game_path = path;

View File

@@ -360,6 +360,8 @@ private:
void OnMoveStart(wxMoveEvent& event);
void OnMoveEnd(wxMoveEvent& event);
void OnSize(wxSizeEvent& event);
void OnIconize(wxIconizeEvent& event);
// Load a named wxDialog from the XRC file
wxDialog* LoadXRCDialog(const char* name);