From f7d1558bc0c539865ae0c158c0afb7ac3cadd8c7 Mon Sep 17 00:00:00 2001 From: Hilderin <81109165+Hilderin@users.noreply.github.com> Date: Mon, 27 Jan 2025 17:59:14 -0500 Subject: [PATCH] Fix Embedded Game disappear when not focused on KDE 5 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: RĂ©mi Verschelde --- platform/linuxbsd/x11/display_server_x11.cpp | 3 ++- platform/linuxbsd/x11/display_server_x11.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/platform/linuxbsd/x11/display_server_x11.cpp b/platform/linuxbsd/x11/display_server_x11.cpp index 51db84fde02..95181a1c817 100644 --- a/platform/linuxbsd/x11/display_server_x11.cpp +++ b/platform/linuxbsd/x11/display_server_x11.cpp @@ -6276,7 +6276,7 @@ DisplayServerX11::WindowID DisplayServerX11::_create_window(WindowMode p_mode, V } } - if (wd.is_popup || wd.no_focus || wd.embed_parent) { + if (wd.is_popup || wd.no_focus || (wd.embed_parent && !kde5_embed_workaround)) { // Set Utility type to disable fade animations. Atom type_atom = XInternAtom(x11_display, "_NET_WM_WINDOW_TYPE_UTILITY", False); Atom wt_atom = XInternAtom(x11_display, "_NET_WM_WINDOW_TYPE", False); @@ -6422,6 +6422,7 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode KeyMappingX11::initialize(); xwayland = OS::get_singleton()->get_environment("XDG_SESSION_TYPE").to_lower() == "wayland"; + kde5_embed_workaround = OS::get_singleton()->get_environment("XDG_CURRENT_DESKTOP").to_lower() == "kde" && OS::get_singleton()->get_environment("KDE_SESSION_VERSION") == "5"; native_menu = memnew(NativeMenu); context = p_context; diff --git a/platform/linuxbsd/x11/display_server_x11.h b/platform/linuxbsd/x11/display_server_x11.h index 166b2cb57b5..edd70d454da 100644 --- a/platform/linuxbsd/x11/display_server_x11.h +++ b/platform/linuxbsd/x11/display_server_x11.h @@ -338,6 +338,7 @@ class DisplayServerX11 : public DisplayServer { bool xinerama_ext_ok = true; bool xshaped_ext_ok = true; bool xwayland = false; + bool kde5_embed_workaround = false; // Workaround embedded game visibility on KDE 5 (GH-102043). struct Property { unsigned char *data;