[Bf-blender-cvs] [5c145bda212] wl_default: GHOST/wayland: use Wayland only when 'BLENDER_WAYLAND' is set

Christian Rauch noreply at git.blender.org
Sat Aug 14 22:29:25 CEST 2021


Commit: 5c145bda212725530e7ce5cdbab2edf9de382e89
Author: Christian Rauch
Date:   Thu Jul 29 23:30:05 2021 +0100
Branches: wl_default
https://developer.blender.org/rB5c145bda212725530e7ce5cdbab2edf9de382e89

GHOST/wayland: use Wayland only when 'BLENDER_WAYLAND' is set

When the X11 and Wayland backends are available, only query Wayland when
the BLENDER_WAYLAND environment variable is set and notify the user if this
failed.
This makes sure that Blender will always use X11. User can then opt-in to
Wayland for testing and can continue using X11 in case of issues.

Differential Revision: D11489

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

M	intern/ghost/intern/GHOST_ISystem.cpp

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

diff --git a/intern/ghost/intern/GHOST_ISystem.cpp b/intern/ghost/intern/GHOST_ISystem.cpp
index d9fecda22a4..8938d0bc0b6 100644
--- a/intern/ghost/intern/GHOST_ISystem.cpp
+++ b/intern/ghost/intern/GHOST_ISystem.cpp
@@ -55,13 +55,21 @@ GHOST_TSuccess GHOST_ISystem::createSystem()
     m_system = new GHOST_SystemNULL();
 #elif defined(WITH_GHOST_X11) && defined(WITH_GHOST_WAYLAND)
     /* Special case, try Wayland, fall back to X11. */
-    try {
-      m_system = new GHOST_SystemWayland();
-    }
-    catch (const std::runtime_error &) {
-      /* fallback to X11. */
-      delete m_system;
-      m_system = nullptr;
+    if (std::getenv("BLENDER_WAYLAND")) {
+      try {
+        m_system = new GHOST_SystemWayland();
+      }
+      catch (const std::runtime_error &e) {
+        /* fallback to X11. */
+        fprintf(stderr,
+                "The Wayland backend was enabled via 'BLENDER_WAYLAND' "\
+                "but it could not be instantiated.\n"
+                "%s\n" \
+                "Falling back to X11.\n",
+                e.what());
+        delete m_system;
+        m_system = nullptr;
+      }
     }
     if (!m_system) {
       m_system = new GHOST_SystemX11();



More information about the Bf-blender-cvs mailing list