Skip to content

Commit 0c4c202

Browse files
committed
Merge branch 'ifavideofallsintheforest' into 'master'
Pause menu video playback when OpenMW is minimized Closes #8441 See merge request OpenMW/openmw!4625
2 parents 8a0f513 + 1667b11 commit 0c4c202

File tree

5 files changed

+22
-6
lines changed

5 files changed

+22
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@
230230
Bug #8364: Crash when clicking scrollbar without handle (divide by zero)
231231
Bug #8378: Korean bitmap fonts are unusable
232232
Bug #8439: Creatures without models can crash the game
233+
Bug #8441: Freeze when using video main menu replacers
233234
Feature #1415: Infinite fall failsafe
234235
Feature #2566: Handle NAM9 records for manual cell references
235236
Feature #3501: OpenMW-CS: Instance Editing - Shortcuts for axial locking

apps/openmw/mwbase/windowmanager.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ namespace MWBase
363363
void windowVisibilityChange(bool visible) override = 0;
364364
void windowResized(int x, int y) override = 0;
365365
void windowClosed() override = 0;
366-
virtual bool isWindowVisible() = 0;
366+
virtual bool isWindowVisible() const = 0;
367367

368368
virtual void watchActor(const MWWorld::Ptr& ptr) = 0;
369369
virtual MWWorld::Ptr getWatchedActor() const = 0;

apps/openmw/mwgui/mainmenu.cpp

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,26 @@ namespace MWGui
2929
{
3030
Misc::FrameRateLimiter frameRateLimiter
3131
= Misc::makeFrameRateLimiter(MWBase::Environment::get().getFrameRateLimit());
32+
const MWBase::WindowManager& windowManager = *MWBase::Environment::get().getWindowManager();
33+
bool paused = false;
3234
while (mRunning)
3335
{
34-
// If finished playing, start again
35-
if (!mVideo->update())
36-
mVideo->playVideo("video\\menu_background.bik");
36+
if (windowManager.isWindowVisible())
37+
{
38+
if (paused)
39+
{
40+
mVideo->resume();
41+
paused = false;
42+
}
43+
// If finished playing, start again
44+
if (!mVideo->update())
45+
mVideo->playVideo("video\\menu_background.bik");
46+
}
47+
else if (!paused)
48+
{
49+
paused = true;
50+
mVideo->pause();
51+
}
3752
frameRateLimiter.limit();
3853
}
3954
}

apps/openmw/mwgui/windowmanagerimp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1218,7 +1218,7 @@ namespace MWGui
12181218
// TODO: check if any windows are now off-screen and move them back if so
12191219
}
12201220

1221-
bool WindowManager::isWindowVisible()
1221+
bool WindowManager::isWindowVisible() const
12221222
{
12231223
return mWindowVisible;
12241224
}

apps/openmw/mwgui/windowmanagerimp.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ namespace MWGui
290290
void windowVisibilityChange(bool visible) override;
291291
void windowResized(int x, int y) override;
292292
void windowClosed() override;
293-
bool isWindowVisible() override;
293+
bool isWindowVisible() const override;
294294

295295
void watchActor(const MWWorld::Ptr& ptr) override;
296296
MWWorld::Ptr getWatchedActor() const override;

0 commit comments

Comments
 (0)