diff options
author | Campbell Barton <campbell@blender.org> | 2022-10-10 11:45:41 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-10-10 11:50:33 +0300 |
commit | f77eadc203679245bd539a7586dedaf55ded4939 (patch) | |
tree | 3e2875e5a64cef6dd8050b94e135b282230eba2c /intern | |
parent | d855f5fdcd88780e41e4599b3efb0c6e8985c720 (diff) |
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.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/ghost/intern/GHOST_SystemWayland.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
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 |