diff --git a/dom/ipc/BrowserChild.cpp b/dom/ipc/BrowserChild.cpp index add61101094d..62af9ebe4fdc 100644 --- a/dom/ipc/BrowserChild.cpp +++ b/dom/ipc/BrowserChild.cpp @@ -2184,7 +2184,7 @@ RefPtr BrowserChild::GetVsyncChild() { // given platform. Note: this only makes sense if nsWindow returns a // window-specific VsyncSource. #if defined(MOZ_WAYLAND) - if (!IsWaylandDisabled() && !mVsyncChild) { + if (IsWaylandEnabled() && !mVsyncChild) { PVsyncChild* actor = SendPVsyncConstructor(); mVsyncChild = static_cast(actor); } diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index 8e9c29d76a62..d117b6880acc 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -661,11 +661,11 @@ bool ContentChild::Init(MessageLoop* aIOLoop, base::ProcessId aParentPid, if (!gfxPlatform::IsHeadless()) { const char* display_name = PR_GetEnv("MOZ_GDK_DISPLAY"); if (!display_name) { - bool waylandDisabled = true; + bool waylandEnabled = false; # ifdef MOZ_WAYLAND - waylandDisabled = IsWaylandDisabled(); + waylandEnabled = IsWaylandEnabled(); # endif - if (waylandDisabled) { + if (!waylandEnabled) { display_name = PR_GetEnv("DISPLAY"); } } diff --git a/gfx/ipc/GPUParent.cpp b/gfx/ipc/GPUParent.cpp index a5d84679d8fe..43fc22babad6 100644 --- a/gfx/ipc/GPUParent.cpp +++ b/gfx/ipc/GPUParent.cpp @@ -275,11 +275,11 @@ mozilla::ipc::IPCResult GPUParent::RecvInit( #if defined(MOZ_WIDGET_GTK) char* display_name = PR_GetEnv("MOZ_GDK_DISPLAY"); if (!display_name) { - bool waylandDisabled = true; + bool waylandEnabled = false; # ifdef MOZ_WAYLAND - waylandDisabled = IsWaylandDisabled(); + waylandEnabled = IsWaylandEnabled(); # endif - if (waylandDisabled) { + if (!waylandEnabled) { display_name = PR_GetEnv("DISPLAY"); } } diff --git a/toolkit/xre/glxtest.cpp b/toolkit/xre/glxtest.cpp index 05fe24332ee1..bdbc2ef79b33 100644 --- a/toolkit/xre/glxtest.cpp +++ b/toolkit/xre/glxtest.cpp @@ -26,7 +26,7 @@ #include #include "mozilla/Unused.h" -#include "nsAppRunner.h" // for IsWaylandDisabled on IsX11EGLEnabled +#include "nsAppRunner.h" // for IsWaylandEnabled on IsX11EGLEnabled #include "stdint.h" #ifdef __SUNPRO_CC @@ -1200,7 +1200,7 @@ int childgltest() { int pci_count = get_pci_status(); #ifdef MOZ_WAYLAND - if (!IsWaylandDisabled()) { + if (IsWaylandEnabled()) { wayland_egltest(); } else #endif diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp index 0aead4ee3a55..edae07114901 100644 --- a/toolkit/xre/nsAppRunner.cpp +++ b/toolkit/xre/nsAppRunner.cpp @@ -4157,7 +4157,12 @@ static void PR_CALLBACK ReadAheadDlls_ThreadStart(void* arg) { #endif #if defined(MOZ_WAYLAND) -bool IsWaylandDisabled() { +bool IsWaylandEnabled() { + const char* waylandDisplay = PR_GetEnv("WAYLAND_DISPLAY"); + if (!waylandDisplay) { + return false; + } + // MOZ_ENABLE_WAYLAND is our primary Wayland on/off switch. const char* waylandPref = PR_GetEnv("MOZ_ENABLE_WAYLAND"); bool enableWayland = (waylandPref && *waylandPref); @@ -4173,7 +4178,7 @@ bool IsWaylandDisabled() { if (enableWayland && gtk_check_version(3, 22, 0) != nullptr) { NS_WARNING("Running Wayland backen on Gtk3 < 3.22. Expect issues/glitches"); } - return !enableWayland; + return enableWayland; } #endif @@ -4362,13 +4367,13 @@ int XREMain::XRE_mainStartup(bool* aExitFlag) { saveDisplayArg = true; } - bool disableWayland = true; + bool waylandEnabled = false; # if defined(MOZ_WAYLAND) - disableWayland = IsWaylandDisabled(); + waylandEnabled = IsWaylandEnabled(); # endif // On Wayland disabled builds read X11 DISPLAY env exclusively // and don't care about different displays. - if (disableWayland && !display_name) { + if (!waylandEnabled && !display_name) { display_name = PR_GetEnv("DISPLAY"); if (!display_name) { PR_fprintf(PR_STDERR, diff --git a/toolkit/xre/nsAppRunner.h b/toolkit/xre/nsAppRunner.h index 48a63f711a3c..bbaca2e14d73 100644 --- a/toolkit/xre/nsAppRunner.h +++ b/toolkit/xre/nsAppRunner.h @@ -167,7 +167,7 @@ void setASanReporterPath(nsIFile* aDir); #endif #ifdef MOZ_WAYLAND -bool IsWaylandDisabled(); +bool IsWaylandEnabled(); #endif #endif // nsAppRunner_h__ diff --git a/widget/GfxInfoX11.cpp b/widget/GfxInfoX11.cpp index c0c8bd40c347..364e1131e608 100644 --- a/widget/GfxInfoX11.cpp +++ b/widget/GfxInfoX11.cpp @@ -462,7 +462,7 @@ void GfxInfo::GetData() { mAdapterDescription.Assign(glRenderer); #ifdef MOZ_WAYLAND mIsWayland = gdk_display_get_default() && - !GDK_IS_X11_DISPLAY(gdk_display_get_default()); + GDK_IS_WAYLAND_DISPLAY(gdk_display_get_default()); if (mIsWayland) { mIsWaylandDRM = GetDMABufDevice()->IsDMABufVAAPIEnabled() || GetDMABufDevice()->IsDMABufWebGLEnabled() || @@ -473,8 +473,8 @@ void GfxInfo::GetData() { // Make a best effort guess at whether or not we are using the XWayland compat // layer. For all intents and purposes, we should otherwise believe we are // using X11. - const char* windowEnv = getenv("XDG_SESSION_TYPE"); - mIsXWayland = windowEnv && strcmp(windowEnv, "wayland") == 0; + const char* waylandDisplay = getenv("WAYLAND_DISPLAY"); + mIsXWayland = !mIsWayland && waylandDisplay; // Make a best effort guess at the desktop environment in use. Sadly there // does not appear to be a standard way to do this, so we check a few