mirror of
https://git.citron-emu.org/citron/emulator
synced 2026-01-31 06:43:35 +00:00
fix(overhaul): UI and resolution bugs for Steam Deck (Gamescope)
Signed-off-by: Collecting <collecting@noreply.localhost>
This commit is contained in:
@@ -28,10 +28,8 @@ Core::HID::EmulatedController* GetPlayer1Controller(Core::System* system) {
|
||||
return hid_core.GetEmulatedController(Core::HID::NpadIdType::Player1);
|
||||
}
|
||||
|
||||
// Helper to detect Gamescope at runtime
|
||||
bool IsGamescope() {
|
||||
static bool gamescope = qgetenv("XDG_CURRENT_DESKTOP") == "gamescope" ||
|
||||
!qgetenv("GAMESCOPE_WIDTH").isEmpty();
|
||||
static bool gamescope = qgetenv("XDG_CURRENT_DESKTOP") == "gamescope";
|
||||
return gamescope;
|
||||
}
|
||||
}
|
||||
@@ -83,24 +81,28 @@ ControllerOverlay::ControllerOverlay(GMainWindow* parent)
|
||||
ControllerOverlay::~ControllerOverlay() = default;
|
||||
|
||||
void ControllerOverlay::UpdateControllerState() {
|
||||
if (!main_window) return;
|
||||
if (!main_window || !is_enabled) return;
|
||||
|
||||
if (IsGamescope()) {
|
||||
bool sub_window_visible = false;
|
||||
bool ui_active = false;
|
||||
for (QWidget* w : QApplication::topLevelWidgets()) {
|
||||
if (w->isWindow() && w->isVisible() && w != main_window && w != this &&
|
||||
!w->inherits("GRenderWindow") && !w->inherits("PerformanceOverlay") && !w->inherits("VramOverlay")) {
|
||||
sub_window_visible = true;
|
||||
break;
|
||||
}
|
||||
!w->inherits("GRenderWindow") &&
|
||||
!w->inherits("PerformanceOverlay") &&
|
||||
!w->inherits("VramOverlay") &&
|
||||
!w->inherits("ControllerOverlay")) {
|
||||
ui_active = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (sub_window_visible) {
|
||||
|
||||
if (ui_active) {
|
||||
if (!this->isHidden()) this->hide();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (this->isHidden()) {
|
||||
if (is_enabled && this->isHidden()) {
|
||||
this->show();
|
||||
}
|
||||
|
||||
@@ -156,3 +158,12 @@ void ControllerOverlay::resizeEvent(QResizeEvent* event) {
|
||||
QWidget::resizeEvent(event);
|
||||
layout()->update();
|
||||
}
|
||||
|
||||
void ControllerOverlay::SetVisible(bool visible) {
|
||||
is_enabled = visible;
|
||||
if (visible) {
|
||||
this->show();
|
||||
} else {
|
||||
this->hide();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user