Skip to content

Commit

Permalink
Merge pull request #18517 from hrydgard/fix-transparent-background-ed…
Browse files Browse the repository at this point in the history
…gecase

Run-behind-pause: Fix some edge cases with the transparent background setting
  • Loading branch information
hrydgard authored Dec 11, 2023
2 parents 65081da + 79ab67e commit bf05420
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 bf05420

Please sign in to comment.