Disabled text scrolling when running media player or screensaver or when running in the background.

This commit is contained in:
Leon Styhre 2021-10-06 17:24:25 +02:00
parent 858677a7d3
commit 42cd0c1ad7
3 changed files with 17 additions and 6 deletions

View file

@ -1120,8 +1120,10 @@ void FileData::launchGame(Window* window)
Scripting::fireEvent("game-end", romPath, getSourceFileData()->metadata.get("name"));
// Re-enable the text scrolling that was disabled in ViewController on game launch.
window->setAllowTextScrolling(true);
// Unless we're running in the background while the game is launched, re-enable the text
// scrolling that was disabled in ViewController.
if (!ViewController::get()->runInBackground(mSystem))
window->setAllowTextScrolling(true);
// Update number of times the game has been launched.
FileData* gameToUpdate = getSourceFileData();

View file

@ -849,9 +849,12 @@ bool ViewController::input(InputConfig* config, Input input)
// background while a game is launched. If we're in this state and then register some
// input, it means that the user is back in ES-DE. Therefore unset the game launch flag
// and update all the GUI components. This will re-enable the video player and let the
// screensaver start on schedule again.
if (mWindow->getGameLaunchedState())
// screensaver start on schedule again. Also re-enable scrolling for TextListComponent
// and ScrollableContainer.
if (mWindow->getGameLaunchedState()) {
mWindow->setAllowTextScrolling(true);
mWindow->unsetLaunchedGame();
}
// Open the main menu.
if (!(UIModeController::getInstance()->isUIModeKid() &&

View file

@ -709,6 +709,7 @@ void Window::startScreensaver()
(*it)->onScreensaverActivate();
stopInfoPopup();
setAllowTextScrolling(false);
mScreensaver->startScreensaver(true);
mRenderScreensaver = true;
}
@ -719,6 +720,7 @@ bool Window::stopScreensaver()
if (mScreensaver && mRenderScreensaver) {
mScreensaver->stopScreensaver();
mRenderScreensaver = false;
setAllowTextScrolling(true);
// Tell the GUI components the screensaver has stopped.
for (auto it = mGuiStack.cbegin(); it != mGuiStack.cend(); it++) {
@ -743,15 +745,19 @@ void Window::renderScreensaver()
void Window::startMediaViewer(FileData* game)
{
if (mMediaViewer) {
if (mMediaViewer->startMediaViewer(game))
if (mMediaViewer->startMediaViewer(game)) {
setAllowTextScrolling(false);
mRenderMediaViewer = true;
}
}
}
void Window::stopMediaViewer()
{
if (mMediaViewer)
if (mMediaViewer) {
mMediaViewer->stopMediaViewer();
setAllowTextScrolling(true);
}
mRenderMediaViewer = false;
}