diff options
author | Christian Rauch <Rauch.Christian@gmx.de> | 2021-07-30 01:30:05 +0300 |
---|---|---|
committer | Christian Rauch <Rauch.Christian@gmx.de> | 2021-08-14 23:27:25 +0300 |
commit | 5c145bda212725530e7ce5cdbab2edf9de382e89 (patch) | |
tree | 0ba3d4343997a74fd85d5106966ebd486d506c93 | |
parent | a3b3e1378567a7b3fe39a8a926d42e8e55916168 (diff) |
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
-rw-r--r-- | intern/ghost/intern/GHOST_ISystem.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
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(); |