[Bf-blender-cvs] [f77eadc2036] master: GHOST/Wayland: warn when falling back to X11 because of missing libdecor

Campbell Barton noreply at git.blender.org
Mon Oct 10 10:51:12 CEST 2022


Commit: f77eadc203679245bd539a7586dedaf55ded4939
Author: Campbell Barton
Date:   Mon Oct 10 19:45:41 2022 +1100
Branches: master
https://developer.blender.org/rBf77eadc203679245bd539a7586dedaf55ded4939

GHOST/Wayland: warn when falling back to X11 because of missing libdecor

X11 is used as a fallback when libdecor isn't found on the users system.

Now print a warning when Blender falls back to X11 and a missing
libdecor is the only reason wayland could not be used.

Only print this warning when using Wayland so this warning doesn't show
on X11 systems which have Wayland libraries installed.

Addresses T101715.

===================================================================

M	intern/ghost/intern/GHOST_SystemWayland.cpp

===================================================================

diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp b/intern/ghost/intern/GHOST_SystemWayland.cpp
index 0721ca78603..7feb6713d03 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.cpp
+++ b/intern/ghost/intern/GHOST_SystemWayland.cpp
@@ -4324,19 +4324,41 @@ bool ghost_wl_dynload_libraries()
    * which will be used as a fallback. */
 #  ifdef WITH_GHOST_X11
   bool verbose = false;
+#    ifdef WITH_GHOST_WAYLAND_LIBDECOR
+  /* When running in Wayland, let the user know if libdecor is the only reason WAYLAND
+   * could not be used. Otherwise it's not obvious why X11 is used as a fallback. */
+  bool verbose_libdecor = getenv("WAYLAND_DISPLAY") != nullptr;
+#    endif
 #  else
   bool verbose = true;
+#    ifdef WITH_GHOST_WAYLAND_LIBDECOR
+  bool verbose_libdecor = true;
+#    endif
+#  endif /* !WITH_GHOST_X11 */
+
+#  ifdef WITH_GHOST_WAYLAND_LIBDECOR
+  int8_t libdecor_init = -1;
 #  endif
 
   if (wayland_dynload_client_init(verbose) && /* `libwayland-client`. */
       wayland_dynload_cursor_init(verbose) && /* `libwayland-cursor`. */
       wayland_dynload_egl_init(verbose) &&    /* `libwayland-egl`. */
 #  ifdef WITH_GHOST_WAYLAND_LIBDECOR
-      wayland_dynload_libdecor_init(verbose) && /* `libdecor-0`. */
+      (libdecor_init = wayland_dynload_libdecor_init(verbose_libdecor)) && /* `libdecor-0`. */
 #  endif
       true) {
     return true;
   }
+
+#  if defined(WITH_GHOST_WAYLAND_LIBDECOR) && defined(WITH_GHOST_X11)
+  if (libdecor_init == 0) {
+    /* LIBDECOR was the only reason X11 was used, let the user know they need it installed. */
+    fprintf(stderr,
+            "WAYLAND found but libdecor was not, install libdecor for Wayland support, "
+            "falling back to X11\n");
+  }
+#  endif
+
 #  ifdef WITH_GHOST_WAYLAND_LIBDECOR
   wayland_dynload_libdecor_exit();
 #  endif



More information about the Bf-blender-cvs mailing list