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")); Scripting::fireEvent("game-end", romPath, getSourceFileData()->metadata.get("name"));
// Re-enable the text scrolling that was disabled in ViewController on game launch. // Unless we're running in the background while the game is launched, re-enable the text
window->setAllowTextScrolling(true); // scrolling that was disabled in ViewController.
if (!ViewController::get()->runInBackground(mSystem))
window->setAllowTextScrolling(true);
// Update number of times the game has been launched. // Update number of times the game has been launched.
FileData* gameToUpdate = getSourceFileData(); 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 // 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 // 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 // and update all the GUI components. This will re-enable the video player and let the
// screensaver start on schedule again. // screensaver start on schedule again. Also re-enable scrolling for TextListComponent
if (mWindow->getGameLaunchedState()) // and ScrollableContainer.
if (mWindow->getGameLaunchedState()) {
mWindow->setAllowTextScrolling(true);
mWindow->unsetLaunchedGame(); mWindow->unsetLaunchedGame();
}
// Open the main menu. // Open the main menu.
if (!(UIModeController::getInstance()->isUIModeKid() && if (!(UIModeController::getInstance()->isUIModeKid() &&

View file

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