From 0e21840973834b6a41b0fec6fc3989b9f9fa8dd9 Mon Sep 17 00:00:00 2001 From: Riteo Date: Tue, 10 Sep 2024 23:03:47 +0200 Subject: [PATCH] Wayland: Add environment variable to disable libdecor loading Libdecor has some quirks and depending on the setup it might be useful to switch to the xdg-shell branch. Recompiling the whole engine without libdecor is not an acceptable way to do that. --- platform/linuxbsd/wayland/wayland_thread.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/platform/linuxbsd/wayland/wayland_thread.cpp b/platform/linuxbsd/wayland/wayland_thread.cpp index dfe4220a038..b08d26c5829 100644 --- a/platform/linuxbsd/wayland/wayland_thread.cpp +++ b/platform/linuxbsd/wayland/wayland_thread.cpp @@ -4749,16 +4749,22 @@ Error WaylandThread::init() { #ifdef LIBDECOR_ENABLED bool libdecor_found = true; + bool skip_libdecor = OS::get_singleton()->get_environment("GODOT_WAYLAND_DISABLE_LIBDECOR") == "1"; + #ifdef SOWRAP_ENABLED - if (initialize_libdecor(dylibloader_verbose) != 0) { + if (!skip_libdecor && initialize_libdecor(dylibloader_verbose) != 0) { libdecor_found = false; } #endif // SOWRAP_ENABLED - if (libdecor_found) { - libdecor_context = libdecor_new(wl_display, (struct libdecor_interface *)&libdecor_interface); + if (skip_libdecor) { + print_verbose("Skipping libdecor check because GODOT_WAYLAND_DISABLE_LIBDECOR is set to 1."); } else { - print_verbose("libdecor not found. Client-side decorations disabled."); + if (libdecor_found) { + libdecor_context = libdecor_new(wl_display, (struct libdecor_interface *)&libdecor_interface); + } else { + print_verbose("libdecor not found. Client-side decorations disabled."); + } } #endif // LIBDECOR_ENABLED