Skip to content

Commit

Permalink
Run-behind-pause: Fix some edge cases with the transparent background…
Browse files Browse the repository at this point in the history
… setting
  • Loading branch information
hrydgard committed Dec 11, 2023
1 parent 65081da commit 79ab67e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
7 changes: 0 additions & 7 deletions Common/UI/Screen.cpp
Expand Up @@ -257,13 +257,6 @@ void ScreenManager::sendMessage(UIMessage message, const char *value) {
}
}

Screen *ScreenManager::topScreen() const {
if (!stack_.empty())
return stack_.back().screen;
else
return 0;
}

void ScreenManager::shutdown() {
std::lock_guard<std::recursive_mutex> guard(inputLock_);
for (auto layer : stack_)
Expand Down
8 changes: 7 additions & 1 deletion Common/UI/Screen.h
Expand Up @@ -90,6 +90,7 @@ class Screen {
virtual void RecreateViews() {}

ScreenManager *screenManager() { return screenManager_; }
const ScreenManager *screenManager() const { return screenManager_; }
void setScreenManager(ScreenManager *sm) { screenManager_ = sm; }

virtual const char *tag() const = 0;
Expand Down Expand Up @@ -158,7 +159,12 @@ class ScreenManager {
// Generic facility for gross hacks :P
void sendMessage(UIMessage message, const char *value);

Screen *topScreen() const;
const Screen *topScreen() const {
return stack_.empty() ? nullptr : stack_.back().screen;
}
Screen *topScreen() {
return stack_.empty() ? nullptr : stack_.back().screen;
}

void getFocusPosition(float &x, float &y, float &z);

Expand Down
8 changes: 4 additions & 4 deletions UI/EmuScreen.cpp
Expand Up @@ -1420,11 +1420,11 @@ bool EmuScreen::canBeBackground(bool isTop) const {
return isTop || (g_Config.bTransparentBackground && g_Config.bRunBehindPauseMenu);
}

bool forceTransparent = false; // this needs to be true somehow on the display layout screen.

if (!g_Config.bTransparentBackground && !forceTransparent)
if (!g_Config.bTransparentBackground && !isTop) {
if (g_Config.bRunBehindPauseMenu || screenManager()->topScreen()->wantBrightBackground())
return true;
return false;

}
return true;
}

Expand Down

0 comments on commit 79ab67e

Please sign in to comment.