17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-08 11:34:19 +01:00

uilayer: Force ui viewports to be disabled under gamescope and Steam Big Picture (#232)

This commit is contained in:
Sebastian Krzyszkowiak
2026-11-07 12:33:46 +01:00
committed by GitHub
parent ecdef7f753
commit 605a94cf2b

View File

@@ -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;