Bug 1522780 - [Wayland] Use MOZ_ENABLE_WAYLAND to enable wayland backend, r=glandium
authorMartin Stransky <stransky@redhat.com>
Tue, 29 Jan 2019 09:27:05 +0000
changeset 455922 b9424178ab0b44acb8fa9a39b686b1e3d8cec9a8
parent 455921 03983e27640da79d652c2990684a4053923a67e3
child 455923 b8b5e133f712fd335e95ff2ff79435972f21b791
push id111564
push usershindli@mozilla.com
push dateTue, 29 Jan 2019 21:55:19 +0000
treeherdermozilla-inbound@9f5f935c3f27 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1522780
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1522780 - [Wayland] Use MOZ_ENABLE_WAYLAND to enable wayland backend, r=glandium Recently we use GDK_BACKEND to enable/disable Wayland backend. That's good for testing but bad for distro deployment. When GDK_BACKEND is set it's propagated to child processes which may not support wayland thus they fail to run. Also when GDK_BACKEND=wayland is set Firefox fails to start when Wayland backend is not available. To allow easy deployment let's use a specific MOZ_ENABLE_WAYLAND env which means to use a default available GTK backend (x11 or wayland) and don't fail when Wayland is missing. Differential Revision: https://phabricator.services.mozilla.com/D17607
toolkit/xre/nsAppRunner.cpp
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -3617,22 +3617,25 @@ int XREMain::XRE_mainStartup(bool* aExit
     // also passed to ContentChild::Init() by MOZ_GDK_DISPLAY.
     if (display_name) {
       SaveWordToEnv("MOZ_GDK_DISPLAY", nsDependentCString(display_name));
       saveDisplayArg = true;
     }
 
     bool disableWayland = true;
 #  if defined(MOZ_WAYLAND)
-    // Make X11 backend the default one.
-    // Enable Wayland backend only when GDK_BACKEND is set and
-    // Gtk+ >= 3.22 where we can expect recent enough
+    // Enable Wayland on Gtk+ >= 3.22 where we can expect recent enough
     // compositor & libwayland interface.
-    disableWayland = (PR_GetEnv("GDK_BACKEND") == nullptr) ||
-                     (gtk_check_version(3, 22, 0) != nullptr);
+    disableWayland = (gtk_check_version(3, 22, 0) != nullptr);
+    if (!disableWayland) {
+      // Make X11 backend the default one unless MOZ_ENABLE_WAYLAND or
+      // GDK_BACKEND are specified.
+      disableWayland = (PR_GetEnv("GDK_BACKEND") == nullptr) &&
+                       (PR_GetEnv("MOZ_ENABLE_WAYLAND") == nullptr);
+    }
 #  endif
     // On Wayland disabled builds read X11 DISPLAY env exclusively
     // and don't care about different displays.
     if (disableWayland && !display_name) {
       display_name = PR_GetEnv("DISPLAY");
       if (!display_name) {
         PR_fprintf(PR_STDERR,
                    "Error: no DISPLAY environment variable specified\n");