From b335901ee65451bb65778140eb461665eeefb128 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Tue, 21 Feb 2023 18:39:56 +0100 Subject: [PATCH] Disabled non-blurred backgrounds when rotating screen 90 or 270 degrees. --- es-app/src/guis/GuiMenu.cpp | 33 +++++++++++++++++++++++---------- es-app/src/guis/GuiMenu.h | 1 + es-core/src/Window.cpp | 5 ++++- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/es-app/src/guis/GuiMenu.cpp b/es-app/src/guis/GuiMenu.cpp index 855f787d6..2e6c080bb 100644 --- a/es-app/src/guis/GuiMenu.cpp +++ b/es-app/src/guis/GuiMenu.cpp @@ -728,16 +728,29 @@ void GuiMenu::openUIOptions() // Blur background when the menu is open. auto menuBlurBackground = std::make_shared(); - menuBlurBackground->setState(Settings::getInstance()->getBool("MenuBlurBackground")); - s->addWithLabel("BLUR BACKGROUND WHEN MENU IS OPEN", menuBlurBackground); - s->addSaveFunc([menuBlurBackground, s] { - if (menuBlurBackground->getState() != - Settings::getInstance()->getBool("MenuBlurBackground")) { - Settings::getInstance()->setBool("MenuBlurBackground", menuBlurBackground->getState()); - s->setNeedsSaving(); - s->setInvalidateCachedBackground(); - } - }); + if (mRenderer->getScreenRotation() == 90 || mRenderer->getScreenRotation() == 270) { + // TODO: Add support for non-blurred background when rotating screen 90 or 270 degrees. + menuBlurBackground->setState(true); + s->addWithLabel("BLUR BACKGROUND WHEN MENU IS OPEN", menuBlurBackground); + menuBlurBackground->setEnabled(false); + menuBlurBackground->setOpacity(DISABLED_OPACITY); + menuBlurBackground->getParent() + ->getChild(menuBlurBackground->getChildIndex() - 1) + ->setOpacity(DISABLED_OPACITY); + } + else { + menuBlurBackground->setState(Settings::getInstance()->getBool("MenuBlurBackground")); + s->addWithLabel("BLUR BACKGROUND WHEN MENU IS OPEN", menuBlurBackground); + s->addSaveFunc([menuBlurBackground, s] { + if (menuBlurBackground->getState() != + Settings::getInstance()->getBool("MenuBlurBackground")) { + Settings::getInstance()->setBool("MenuBlurBackground", + menuBlurBackground->getState()); + s->setNeedsSaving(); + s->setInvalidateCachedBackground(); + } + }); + } // Display pillarboxes (and letterboxes) for videos in the gamelists. auto gamelistVideoPillarbox = std::make_shared(); diff --git a/es-app/src/guis/GuiMenu.h b/es-app/src/guis/GuiMenu.h index a178dc3e5..1b9c3cd4e 100644 --- a/es-app/src/guis/GuiMenu.h +++ b/es-app/src/guis/GuiMenu.h @@ -46,6 +46,7 @@ private: void openOtherOptions(); void openQuitMenu(); + Renderer* mRenderer; MenuComponent mMenu; TextComponent mVersion; }; diff --git a/es-core/src/Window.cpp b/es-core/src/Window.cpp index 9d8d89944..943120d4f 100644 --- a/es-core/src/Window.cpp +++ b/es-core/src/Window.cpp @@ -505,7 +505,10 @@ void Window::render() // of iterations relative to the screen resolution. Renderer::postProcessingParams backgroundParameters; - if (Settings::getInstance()->getBool("MenuBlurBackground")) { + // TODO: Add support for non-blurred background when rotating screen 90 or 270 + // degrees. + if (Settings::getInstance()->getBool("MenuBlurBackground") || + mRenderer->getScreenRotation() == 90 || mRenderer->getScreenRotation() == 270) { const float resolutionModifier {mRenderer->getScreenResolutionModifier()}; // clang-format off if (resolutionModifier < 1)