Bug 1522780 - [Wayland] Use MOZ_ENABLE_WAYLAND to enable wayland backend, r=glandium a=lizzard
authorMartin Stransky <stransky@redhat.com>
Tue, 29 Jan 2019 09:27:05 +0000
changeset 515643 72201a8d9d95ed3d4a8d88b2cfe446e1ccc149e9
parent 515642 72fd8e42b6cbb3cb580b1bc2ee29b6d4af4b1052
child 515644 9df1f456d924ec6a3dc096d2c5e0e6da193d5a45
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium, lizzard
bugs1522780
milestone66.0
Bug 1522780 - [Wayland] Use MOZ_ENABLE_WAYLAND to enable wayland backend, r=glandium a=lizzard 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");