mirror of
https://git.eden-emu.dev/archive/citron
synced 2026-04-06 11:18:51 -04: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);
|
return hid_core.GetEmulatedController(Core::HID::NpadIdType::Player1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper to detect Gamescope at runtime
|
|
||||||
bool IsGamescope() {
|
bool IsGamescope() {
|
||||||
static bool gamescope = qgetenv("XDG_CURRENT_DESKTOP") == "gamescope" ||
|
static bool gamescope = qgetenv("XDG_CURRENT_DESKTOP") == "gamescope";
|
||||||
!qgetenv("GAMESCOPE_WIDTH").isEmpty();
|
|
||||||
return gamescope;
|
return gamescope;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -83,24 +81,28 @@ ControllerOverlay::ControllerOverlay(GMainWindow* parent)
|
|||||||
ControllerOverlay::~ControllerOverlay() = default;
|
ControllerOverlay::~ControllerOverlay() = default;
|
||||||
|
|
||||||
void ControllerOverlay::UpdateControllerState() {
|
void ControllerOverlay::UpdateControllerState() {
|
||||||
if (!main_window) return;
|
if (!main_window || !is_enabled) return;
|
||||||
|
|
||||||
if (IsGamescope()) {
|
if (IsGamescope()) {
|
||||||
bool sub_window_visible = false;
|
bool ui_active = false;
|
||||||
for (QWidget* w : QApplication::topLevelWidgets()) {
|
for (QWidget* w : QApplication::topLevelWidgets()) {
|
||||||
if (w->isWindow() && w->isVisible() && w != main_window && w != this &&
|
if (w->isWindow() && w->isVisible() && w != main_window && w != this &&
|
||||||
!w->inherits("GRenderWindow") && !w->inherits("PerformanceOverlay") && !w->inherits("VramOverlay")) {
|
!w->inherits("GRenderWindow") &&
|
||||||
sub_window_visible = true;
|
!w->inherits("PerformanceOverlay") &&
|
||||||
break;
|
!w->inherits("VramOverlay") &&
|
||||||
}
|
!w->inherits("ControllerOverlay")) {
|
||||||
|
ui_active = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (sub_window_visible) {
|
|
||||||
|
if (ui_active) {
|
||||||
if (!this->isHidden()) this->hide();
|
if (!this->isHidden()) this->hide();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->isHidden()) {
|
if (is_enabled && this->isHidden()) {
|
||||||
this->show();
|
this->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,3 +158,12 @@ void ControllerOverlay::resizeEvent(QResizeEvent* event) {
|
|||||||
QWidget::resizeEvent(event);
|
QWidget::resizeEvent(event);
|
||||||
layout()->update();
|
layout()->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ControllerOverlay::SetVisible(bool visible) {
|
||||||
|
is_enabled = visible;
|
||||||
|
if (visible) {
|
||||||
|
this->show();
|
||||||
|
} else {
|
||||||
|
this->hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user