From 605a94cf2b66214ca4ebc24c841952c504a1f973 Mon Sep 17 00:00:00 2001 From: Sebastian Krzyszkowiak Date: Sat, 7 Nov 2026 12:33:46 +0100 Subject: [PATCH] uilayer: Force ui viewports to be disabled under gamescope and Steam Big Picture (#232) --- application/uilayer.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/application/uilayer.cpp b/application/uilayer.cpp index 2b1fa1686..5443d158c 100644 --- a/application/uilayer.cpp +++ b/application/uilayer.cpp @@ -395,10 +395,15 @@ bool ui_layer::init(GLFWwindow *Window) } // panels can be docked together, and dragged out of the simulator window into windows of their own (e.g. on another monitor) - // when both backends can do it. glfw can't place windows under wayland. both flags have to be set before the first frame + // when both backends can do it. glfw can't place windows under wayland. gamescope does not work well with popup windows. + // both flags have to be set before the first frame m_imguiio->ConfigFlags |= ImGuiConfigFlags_DockingEnable; + const char* desktop = std::getenv("XDG_CURRENT_DESKTOP"); + const char* gamepadui = std::getenv("SteamGamepadUI"); + if (!desktop) desktop = ""; + if (!gamepadui) gamepadui = ""; auto const viewportsupport{(m_imguiio->BackendFlags & ImGuiBackendFlags_PlatformHasViewports) && (m_imguiio->BackendFlags & ImGuiBackendFlags_RendererHasViewports) && - glfwGetPlatform() != GLFW_PLATFORM_WAYLAND}; + glfwGetPlatform() != GLFW_PLATFORM_WAYLAND && std::string_view{desktop} != "gamescope" && std::string_view{gamepadui} != "1"}; if (Global.ui_viewports && viewportsupport) { m_imguiio->ConfigFlags |= ImGuiConfigFlags_ViewportsEnable;