From 42cd0c1ad77a4fd2d8ea288710c61ad9b6c97319 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Wed, 6 Oct 2021 17:24:25 +0200 Subject: [PATCH] Disabled text scrolling when running media player or screensaver or when running in the background. --- es-app/src/FileData.cpp | 6 ++++-- es-app/src/views/ViewController.cpp | 7 +++++-- es-core/src/Window.cpp | 10 ++++++++-- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/es-app/src/FileData.cpp b/es-app/src/FileData.cpp index 8b441da80..f013dfa76 100644 --- a/es-app/src/FileData.cpp +++ b/es-app/src/FileData.cpp @@ -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(); diff --git a/es-app/src/views/ViewController.cpp b/es-app/src/views/ViewController.cpp index 21e5c355d..f63ff76e9 100644 --- a/es-app/src/views/ViewController.cpp +++ b/es-app/src/views/ViewController.cpp @@ -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() && diff --git a/es-core/src/Window.cpp b/es-core/src/Window.cpp index f23d9f96d..493ee1934 100644 --- a/es-core/src/Window.cpp +++ b/es-core/src/Window.cpp @@ -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; }