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.
This commit is contained in:
Campbell Barton 2022-10-10 19:45:41 +11:00
parent d855f5fdcd
commit f77eadc203
Notes: blender-bot 2023-02-14 06:23:08 +01:00
Referenced by issue #101715, Blender 3.4.0 Alpha does not use Wayland under Linux yet...
1 changed files with 23 additions and 1 deletions

View File

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