diff --git a/extra/firefox/build b/extra/firefox/build index cc2923cb..76949f48 100755 --- a/extra/firefox/build +++ b/extra/firefox/build @@ -4,9 +4,6 @@ for p in *.patch; do patch -p1 < "$p" done -# X11-less webrtc patch from bugzilla. Very large so a URL is used. -patch -p1 < attachment.cgi\?id=9202429 - # Build autoconf 2.13 for Firefox's sole use. # See: https://bugzilla.mozilla.org/show_bug.cgi?id=104642 ( @@ -60,11 +57,10 @@ export LDFLAGS="$LDFLAGS -Wl,-rpath=/usr/lib/firefox,--enable-new-dtags" export RUSTFLAGS="$RUSTFLAGS -Cdebuginfo=0" export MACH_USE_SYSTEM_PYTHON=1 export MOZ_DEBUG_FLAGS=-g0 -export MOZBUILD_STATE_PATH=$PWD/state +export MOZBUILD_STATE_PATH="$PWD/state" export MOZ_NOSPAM=1 cat > .mozconfig << EOF -ac_add_options --enable-default-toolkit=cairo-gtk3-wayland ac_add_options --prefix=/usr ac_add_options --libdir=/usr/lib ac_add_options --enable-alsa @@ -75,6 +71,7 @@ ac_add_options --enable-install-strip ac_add_options --enable-official-branding ac_add_options --enable-application=browser ac_add_options --enable-optimize="${CFLAGS:-} -w" +ac_add_options --with-wayland ac_add_options --with-system-libvpx ac_add_options --with-system-ffi ac_add_options --with-system-png @@ -83,9 +80,9 @@ ac_add_options --with-system-zlib ac_add_options --with-system-pixman ac_add_options --without-system-nss ac_add_options --without-system-nspr +ac_add_options --without-wasm-sandboxed-libraries ac_add_options --disable-eme ac_add_options --disable-dbus -ac_add_options --disable-gold ac_add_options --disable-tests ac_add_options --disable-vtune ac_add_options --disable-updater @@ -116,4 +113,3 @@ rm -rf \ "$1/usr/lib/firefox/browser/features/webcompat-reporter@mozilla.org.xpi" \ "$1/usr/lib/firefox/browser/features/webcompat@mozilla.org.xpi" \ "$1/usr/lib/firefox/browser/features/doh-rollout@mozilla.org.xpi" - diff --git a/extra/firefox/checksums b/extra/firefox/checksums index f993c71e..04d521cb 100644 --- a/extra/firefox/checksums +++ b/extra/firefox/checksums @@ -1,10 +1,9 @@ -b7bb8c5fcc74a74e9d2b55d1e9415b891305fe86520fb854cec25024d7e5de67 +c9f127741beabde78b021dc95b1740259d01677d461400682cb30e072126f075 f0611136bee505811e9ca11ca7ac188ef5323a8e2ef19cffd3edb3cf08fd791e 3dce6601b495f5b3d45b59f7d2492a340ee7e84b5beca17e48f862502bd5603f f0e8bb1f9b7eb0b01285495a2699df3a4b766784c1765a8f1aeedf63c0806369 036d96991646d0449ed0aa952e4fbe21b476ce994abc276e49d30e686708bd37 -42b3c7a29e61905be0e7425b8786870eb1d1c9e0f74c3f0909521b2ac52ac702 -2b5732c15e7eade2a01ad9794de372f25fbb75e4e2f53bce089548bcbbba20d1 -4b06181475f667ae2851540552ade56d5257a03cd21da588e2eb1e538bbc8176 -bb20235914fd82976508eb72bf4810b467d3ba1d47a1031e00f7995b9933ae56 -47d30d0b73d3174f8ebbb6d686892fa5435beb3355ddacded70194ef0249ba51 +e7b948b4680e5de9552a03995482d41ffad1b59569736693648bd4d570b952aa +86ce49e650dd117f0f2928a7f810a58df526b1087c274d35eeb9c5bbf09eac5b +4a232e3aa3973894a58c126b9e901c924d4e1ca3e00c4fc82d08de4b880183a9 +ee8f36e22d955bdbad10e93813e928e783c965dc640c4bcea8b95ef9d0b9d23d diff --git a/extra/firefox/patches/fix-clang-as.patch b/extra/firefox/patches/fix-clang-as.patch index bb7c2557..6fe268b4 100644 --- a/extra/firefox/patches/fix-clang-as.patch +++ b/extra/firefox/patches/fix-clang-as.patch @@ -1,5 +1,5 @@ diff --git a/security/nss/lib/freebl/Makefile b/security/nss/lib/freebl/Makefile -index 0b8c6f4..e9668e1 100644 +index 0b8c6f42fa..e9668e100d 100644 --- a/security/nss/lib/freebl/Makefile +++ b/security/nss/lib/freebl/Makefile @@ -753,7 +753,6 @@ $(OBJDIR)/$(PROG_PREFIX)intel-gcm-wrap$(OBJ_SUFFIX): CFLAGS += -mssse3 @@ -11,7 +11,7 @@ index 0b8c6f4..e9668e1 100644 endif diff --git a/security/nss/lib/freebl/freebl.gyp b/security/nss/lib/freebl/freebl.gyp -index e7703ba..3ee3435 100644 +index e7703baf8d..3ee3435de0 100644 --- a/security/nss/lib/freebl/freebl.gyp +++ b/security/nss/lib/freebl/freebl.gyp @@ -19,13 +19,10 @@ @@ -29,7 +29,7 @@ index e7703ba..3ee3435 100644 }], ], diff --git a/security/nss/lib/freebl/freebl_base.gypi b/security/nss/lib/freebl/freebl_base.gypi -index afbffac..795bbd8 100644 +index afbffac729..795bbd87f6 100644 --- a/security/nss/lib/freebl/freebl_base.gypi +++ b/security/nss/lib/freebl/freebl_base.gypi @@ -74,13 +74,10 @@ diff --git a/extra/firefox/patches/fix-linux-header.patch b/extra/firefox/patches/fix-linux-header.patch index 02fc5022..9f7fc51a 100644 --- a/extra/firefox/patches/fix-linux-header.patch +++ b/extra/firefox/patches/fix-linux-header.patch @@ -1,5 +1,5 @@ diff --git a/dom/media/webrtc/transport/third_party/nICEr/src/stun/addrs-netlink.c b/dom/media/webrtc/transport/third_party/nICEr/src/stun/addrs-netlink.c -index 73e85c6..9eca548 100644 +index 73e85c6ccc..9eca548638 100644 --- a/dom/media/webrtc/transport/third_party/nICEr/src/stun/addrs-netlink.c +++ b/dom/media/webrtc/transport/third_party/nICEr/src/stun/addrs-netlink.c @@ -31,6 +31,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/extra/firefox/patches/no-fribidi.patch b/extra/firefox/patches/no-fribidi.patch index e8d1fc44..89b4468a 100644 --- a/extra/firefox/patches/no-fribidi.patch +++ b/extra/firefox/patches/no-fribidi.patch @@ -1,5 +1,5 @@ diff --git a/config/system-headers.mozbuild b/config/system-headers.mozbuild -index 6e017df..7659b8e 100644 +index a1b58eb59b..d35da57db3 100644 --- a/config/system-headers.mozbuild +++ b/config/system-headers.mozbuild @@ -267,7 +267,6 @@ system_headers = [ diff --git a/extra/firefox/patches/no-x11.patch b/extra/firefox/patches/no-x11.patch index 1c4ac398..b1c64d02 100644 --- a/extra/firefox/patches/no-x11.patch +++ b/extra/firefox/patches/no-x11.patch @@ -1,404 +1,477 @@ -diff --git a/gfx/angle/checkout/include/EGL/eglplatform.h b/gfx/angle/checkout/include/EGL/eglplatform.h -index 9ebaf00a9b..f1cc658219 100644 ---- a/gfx/angle/checkout/include/EGL/eglplatform.h -+++ b/gfx/angle/checkout/include/EGL/eglplatform.h -@@ -115,7 +115,8 @@ typedef void *EGLNativeDisplayType; - typedef khronos_uintptr_t EGLNativePixmapType; - typedef khronos_uintptr_t EGLNativeWindowType; +diff --git a/dom/media/systemservices/video_engine/desktop_device_info_x11.cc b/dom/media/systemservices/video_engine/desktop_device_info_x11.cc +index a9f88f0f90..7cfe45533c 100644 +--- a/dom/media/systemservices/video_engine/desktop_device_info_x11.cc ++++ b/dom/media/systemservices/video_engine/desktop_device_info_x11.cc +@@ -7,10 +7,6 @@ --#elif defined(__unix__) || defined(USE_X11) -+#elif defined(__unix__) -+#if defined(USE_X11) + #include - /* X11 (tentative) */ - #include -@@ -124,6 +125,11 @@ typedef khronos_uintptr_t EGLNativeWindowType; - typedef Display *EGLNativeDisplayType; - typedef Pixmap EGLNativePixmapType; - typedef Window EGLNativeWindowType; -+#else -+typedef void *EGLNativeDisplayType; -+typedef khronos_uintptr_t EGLNativePixmapType; -+typedef khronos_uintptr_t EGLNativeWindowType; -+#endif +-#if !defined(WEBRTC_USE_X11) || !defined(MOZ_X11) +-# error Bad build setup, some X11 defines are missing +-#endif +- + namespace webrtc { - #elif defined(__APPLE__) + DesktopDeviceInfo* DesktopDeviceInfoImpl::Create() { +diff --git a/gfx/angle/moz.build.common b/gfx/angle/moz.build.common +index 8769a2fe96..6976853b35 100644 +--- a/gfx/angle/moz.build.common ++++ b/gfx/angle/moz.build.common +@@ -12,6 +12,9 @@ CXXFLAGS += CONFIG['MOZ_X11_CFLAGS'] + if CONFIG['INTEL_ARCHITECTURE']: + CXXFLAGS += CONFIG['SSE2_FLAGS'] + ++if not CONFIG['MOZ_X11']: ++ DEFINES['EGL_NO_X11'] = True ++ + if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': + DEFINES['ANGLE_IS_WIN'] = True diff --git a/gfx/cairo/cairo/src/cairo-features.h b/gfx/cairo/cairo/src/cairo-features.h -index cfed9d9a2f..fd1eb869d3 100644 +index cfed9d9a2f..ad9abeaab1 100644 --- a/gfx/cairo/cairo/src/cairo-features.h +++ b/gfx/cairo/cairo/src/cairo-features.h -@@ -55,8 +55,8 @@ - #define CAIRO_HAS_PDF_SURFACE 1 +@@ -56,7 +56,6 @@ #endif --#ifdef MOZ_X11 - #define CAIRO_HAS_PS_SURFACE 1 -+#ifdef MOZ_X11 + #ifdef MOZ_X11 +-#define CAIRO_HAS_PS_SURFACE 1 #define CAIRO_HAS_XLIB_XRENDER_SURFACE 0 #define CAIRO_HAS_XLIB_SURFACE 1 #endif -diff --git a/gfx/gl/GLContextProvider.h b/gfx/gl/GLContextProvider.h -index 12d1a497b9..bec4cd17f0 100644 ---- a/gfx/gl/GLContextProvider.h -+++ b/gfx/gl/GLContextProvider.h -@@ -55,17 +55,17 @@ namespace gl { - # define GL_CONTEXT_PROVIDER_NAME GLContextProviderX11 - # include "GLContextProviderImpl.h" - # undef GL_CONTEXT_PROVIDER_NAME --# if defined(MOZ_WAYLAND) --# define GL_CONTEXT_PROVIDER_NAME GLContextProviderWayland --# include "GLContextProviderImpl.h" --# undef GL_CONTEXT_PROVIDER_NAME --# define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderWayland --# endif - # ifndef GL_CONTEXT_PROVIDER_DEFAULT - # define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderX11 - # endif +@@ -78,6 +77,7 @@ #endif -+#if defined(MOZ_WAYLAND) -+# define GL_CONTEXT_PROVIDER_NAME GLContextProviderWayland -+# include "GLContextProviderImpl.h" -+# undef GL_CONTEXT_PROVIDER_NAME -+# define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderWayland -+#endif - #ifndef GL_CONTEXT_PROVIDER_DEFAULT - # define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderEGL - #endif -diff --git a/gfx/gl/GLContextProviderWayland.cpp b/gfx/gl/GLContextProviderWayland.cpp -index 3f1f926cd9..cd49dc5f17 100644 ---- a/gfx/gl/GLContextProviderWayland.cpp -+++ b/gfx/gl/GLContextProviderWayland.cpp -@@ -14,7 +14,6 @@ namespace mozilla::gl { - using namespace mozilla::gfx; - using namespace mozilla::widget; + #define CAIRO_HAS_TEE_SURFACE 1 ++#define CAIRO_HAS_PS_SURFACE 1 --static class GLContextProviderX11 sGLContextProviderX11; - static class GLContextProviderEGL sGLContextProviderEGL; - - // Note that if there is no GTK display, `GdkIsX11Display` and -@@ -30,41 +29,24 @@ static class GLContextProviderEGL sGLContextProviderEGL; - already_AddRefed GLContextProviderWayland::CreateForCompositorWidget( - CompositorWidget* aCompositorWidget, bool aHardwareWebRender, - bool aForceAccelerated) { -- if (GdkIsWaylandDisplay()) { - return sGLContextProviderEGL.CreateForCompositorWidget( - aCompositorWidget, aHardwareWebRender, aForceAccelerated); -- } else { -- return sGLContextProviderX11.CreateForCompositorWidget( -- aCompositorWidget, aHardwareWebRender, aForceAccelerated); -- } - } - - /*static*/ - already_AddRefed GLContextProviderWayland::CreateHeadless( - const GLContextCreateDesc& desc, nsACString* const out_failureId) { -- if (GdkIsWaylandDisplay()) { - return sGLContextProviderEGL.CreateHeadless(desc, out_failureId); -- } else { -- return sGLContextProviderX11.CreateHeadless(desc, out_failureId); -- } - } - - /*static*/ - GLContext* GLContextProviderWayland::GetGlobalContext() { -- if (GdkIsWaylandDisplay()) { - return sGLContextProviderEGL.GetGlobalContext(); -- } else { -- return sGLContextProviderX11.GetGlobalContext(); -- } - } - - /*static*/ - void GLContextProviderWayland::Shutdown() { -- if (GdkIsWaylandDisplay()) { - sGLContextProviderEGL.Shutdown(); -- } else { -- sGLContextProviderX11.Shutdown(); -- } - } - - } // namespace mozilla::gl + #ifdef USE_FC_FREETYPE + #define CAIRO_HAS_FC_FONT 1 diff --git a/gfx/gl/moz.build b/gfx/gl/moz.build -index 7ac6b0753a..a817a6fb08 100644 +index 03434957cc..c4727d79a1 100644 --- a/gfx/gl/moz.build +++ b/gfx/gl/moz.build -@@ -13,7 +13,7 @@ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa": +@@ -13,10 +13,10 @@ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa": elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "uikit": gl_provider = "EAGL" elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk": - if CONFIG["MOZ_EGL_XRENDER_COMPOSITE"]: -+ if CONFIG["MOZ_EGL_XRENDER_COMPOSITE"] or CONFIG["MOZ_WAYLAND"]: - gl_provider = "EGL" - else: +- gl_provider = "EGL" +- else: ++ if CONFIG["MOZ_X11"]: gl_provider = "GLX" -diff --git a/gfx/layers/AnimationHelper.h b/gfx/layers/AnimationHelper.h -index f5a57b9c4d..72091c3a4f 100644 ---- a/gfx/layers/AnimationHelper.h -+++ b/gfx/layers/AnimationHelper.h -@@ -7,6 +7,7 @@ - #ifndef mozilla_layers_AnimationHelper_h - #define mozilla_layers_AnimationHelper_h ++ else: ++ gl_provider = "EGL" + elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "android": + gl_provider = "EGL" -+#include "X11UndefineNone.h" - #include "mozilla/dom/Nullable.h" - #include "mozilla/ComputedTimingFunction.h" // for ComputedTimingFunction - #include "mozilla/layers/AnimationStorageData.h" -@@ -15,7 +16,6 @@ - #include "mozilla/TimeStamp.h" // for TimeStamp - #include "mozilla/TimingParams.h" - #include "mozilla/Types.h" // for SideBits --#include "X11UndefineNone.h" - #include +@@ -117,7 +117,10 @@ elif gl_provider == "GLX": + EXPORTS += ["GLContextGLX.h", "GLXLibrary.h"] - namespace mozilla { + if CONFIG["MOZ_WAYLAND"]: +- SOURCES += ["GLContextProviderWayland.cpp", "SharedSurfaceDMABUF.cpp"] ++ SOURCES += ["SharedSurfaceDMABUF.cpp"] ++ ++if CONFIG["MOZ_X11"] and CONFIG["MOZ_WAYLAND"]: ++ SOURCES += ["GLContextProviderWayland.cpp"] + + UNIFIED_SOURCES += [ + "AndroidSurfaceTexture.cpp", +diff --git a/gfx/layers/client/TextureClient.cpp b/gfx/layers/client/TextureClient.cpp +index aaec3c3510..65bee9f869 100644 +--- a/gfx/layers/client/TextureClient.cpp ++++ b/gfx/layers/client/TextureClient.cpp +@@ -48,8 +48,6 @@ + # include "mozilla/layers/TextureD3D11.h" + #endif + #ifdef MOZ_WAYLAND +-# include +- + # include "gfxPlatformGtk.h" + # include "mozilla/layers/DMABUFTextureClientOGL.h" + # include "mozilla/widget/nsWaylandDisplay.h" diff --git a/gfx/thebes/gfxPlatformGtk.cpp b/gfx/thebes/gfxPlatformGtk.cpp -index 197d33b85f..0d3cd3d7f2 100644 +index 1b46a2aab8..4a487e0b78 100644 --- a/gfx/thebes/gfxPlatformGtk.cpp +++ b/gfx/thebes/gfxPlatformGtk.cpp -@@ -31,7 +31,9 @@ +@@ -31,11 +31,11 @@ #include "mozilla/FontPropertyTypes.h" #include "mozilla/gfx/2D.h" #include "mozilla/gfx/Logging.h" -+#ifdef MOZ_X11 - #include "mozilla/gfx/XlibDisplay.h" -+#endif +-#include "mozilla/gfx/XlibDisplay.h" #include "mozilla/Monitor.h" #include "mozilla/Preferences.h" #include "mozilla/StaticPrefs_gfx.h" -@@ -63,6 +65,9 @@ - # include "mozilla/widget/nsWaylandDisplay.h" - # include "mozilla/widget/DMABufLibWrapper.h" - # include "mozilla/StaticPrefs_widget.h" -+# ifdef MOZ_WIDGET_GTK -+# include "mozilla/WidgetUtilsGtk.h" -+# endif - #endif + #include "mozilla/StaticPrefs_layers.h" ++#include "mozilla/WidgetUtilsGtk.h" + #include "nsAppRunner.h" + #include "nsIGfxInfo.h" + #include "nsMathUtils.h" +@@ -52,6 +52,7 @@ + # include "GLXLibrary.h" + # include "mozilla/X11Util.h" + # include "SoftwareVsyncSource.h" ++# include "mozilla/gfx/XlibDisplay.h" - #define GDK_PIXMAP_SIZE_MAX 32767 -@@ -98,7 +103,11 @@ gfxPlatformGtk::gfxPlatformGtk() { - } - - mMaxGenericSubstitutions = UNINITIALIZED_VALUE; -+#ifdef MOZ_X11 - mIsX11Display = gfxPlatform::IsHeadless() ? false : GdkIsX11Display(); -+#else -+ mIsX11Display = false; -+#endif - if (XRE_IsParentProcess()) { - InitX11EGLConfig(); - if (IsWaylandDisplay() || gfxConfig::IsEnabled(Feature::X11_EGL)) { -@@ -125,7 +134,7 @@ gfxPlatformGtk::gfxPlatformGtk() { - - // Bug 1714483: Force disable FXAA Antialiasing on NV drivers. This is a - // temporary workaround for a driver bug. -- PR_SetEnv("__GL_ALLOW_FXAA_USAGE=0"); -+ // PR_SetEnv("__GL_ALLOW_FXAA_USAGE=0"); - } - - gfxPlatformGtk::~gfxPlatformGtk() { -diff --git a/gfx/thebes/moz.build b/gfx/thebes/moz.build -index 3f483d180e..c3ef71a71c 100644 ---- a/gfx/thebes/moz.build -+++ b/gfx/thebes/moz.build -@@ -116,7 +116,6 @@ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk": - ] - EXPORTS.mozilla.gfx += [ - "PrintTargetPDF.h", -- "PrintTargetPS.h", - ] - SOURCES += [ - "gfxFcPlatformFontList.cpp", -@@ -124,12 +123,12 @@ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk": - "gfxFT2Utils.cpp", - "gfxPlatformGtk.cpp", - "PrintTargetPDF.cpp", -- "PrintTargetPS.cpp", - ] - - if CONFIG["MOZ_X11"]: - EXPORTS += [ - "gfxXlibSurface.h", -+ "PrintTargetPS.h", - ] - EXPORTS.mozilla.gfx += [ - "XlibDisplay.h", -@@ -137,6 +136,7 @@ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk": - SOURCES += [ - "gfxXlibSurface.cpp", - "XlibDisplay.cpp", -+ "PrintTargetPS.cpp", - ] - - elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows": + /* Undefine the Status from Xlib since it will conflict with system headers on + * OSX */ diff --git a/gfx/webrender_bindings/RenderCompositorOGLSWGL.cpp b/gfx/webrender_bindings/RenderCompositorOGLSWGL.cpp -index cf3fc3c2ca..2748887361 100644 +index 00a6c3ef6d..78c4235268 100644 --- a/gfx/webrender_bindings/RenderCompositorOGLSWGL.cpp +++ b/gfx/webrender_bindings/RenderCompositorOGLSWGL.cpp -@@ -27,7 +27,9 @@ +@@ -27,7 +27,6 @@ #ifdef MOZ_WIDGET_GTK # include "mozilla/widget/GtkCompositorWidget.h" # include -+# ifdef MOZ_X11 - # include -+# endif +-# include #endif namespace mozilla { +diff --git a/python/mozboot/mozboot/gentoo.py b/python/mozboot/mozboot/gentoo.py +index a33677a0a1..cb9e3dd338 100644 +--- a/python/mozboot/mozboot/gentoo.py ++++ b/python/mozboot/mozboot/gentoo.py +@@ -33,7 +33,6 @@ class GentooBootstrapper(LinuxBootstrapper, BaseBootstrapper): + "dev-libs/dbus-glib", + "media-sound/pulseaudio", + "x11-libs/gtk+:3", +- "x11-libs/libXt", + ] + ) + +diff --git a/third_party/libwebrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build b/third_party/libwebrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build +index a5cf9234d1..ddce223c19 100644 +--- a/third_party/libwebrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build ++++ b/third_party/libwebrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build +@@ -93,11 +93,9 @@ if CONFIG["OS_TARGET"] == "Linux": + DEFINES["USE_NSS_CERTS"] = "1" + DEFINES["USE_OZONE"] = "1" + DEFINES["USE_UDEV"] = True +- DEFINES["USE_X11"] = "1" + DEFINES["WEBRTC_LINUX"] = True + DEFINES["WEBRTC_POSIX"] = True + DEFINES["WEBRTC_USE_PIPEWIRE"] = True +- DEFINES["WEBRTC_USE_X11"] = True + DEFINES["_FILE_OFFSET_BITS"] = "64" + DEFINES["_GNU_SOURCE"] = True + DEFINES["_LARGEFILE64_SOURCE"] = True +@@ -115,14 +113,6 @@ if CONFIG["OS_TARGET"] == "Linux": + OS_LIBS += [ + "dl", + "rt", +- "X11", +- "Xcomposite", +- "Xdamage", +- "Xext", +- "Xfixes", +- "Xrandr", +- "Xrender", +- "Xtst" + ] + + SOURCES += [ +@@ -130,22 +120,26 @@ if CONFIG["OS_TARGET"] == "Linux": + ] + + UNIFIED_SOURCES += [ +- "/third_party/libwebrtc/modules/desktop_capture/linux/mouse_cursor_monitor_x11.cc", + "/third_party/libwebrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc", +- "/third_party/libwebrtc/modules/desktop_capture/linux/screen_capturer_x11.cc", +- "/third_party/libwebrtc/modules/desktop_capture/linux/shared_x_display.cc", + "/third_party/libwebrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc", +- "/third_party/libwebrtc/modules/desktop_capture/linux/window_capturer_x11.cc", +- "/third_party/libwebrtc/modules/desktop_capture/linux/window_finder_x11.cc", +- "/third_party/libwebrtc/modules/desktop_capture/linux/window_list_utils.cc", +- "/third_party/libwebrtc/modules/desktop_capture/linux/x_atom_cache.cc", +- "/third_party/libwebrtc/modules/desktop_capture/linux/x_error_trap.cc", +- "/third_party/libwebrtc/modules/desktop_capture/linux/x_server_pixel_buffer.cc", +- "/third_party/libwebrtc/modules/desktop_capture/linux/x_window_property.cc", + "/third_party/libwebrtc/modules/desktop_capture/mouse_cursor_monitor_linux.cc", + "/third_party/libwebrtc/modules/desktop_capture/screen_capturer_linux.cc", + "/third_party/libwebrtc/modules/desktop_capture/window_capturer_linux.cc" + ] ++ ++ if CONFIG["MOZ_X11"]: ++ UNIFIED_SOURCES += [ ++ "/third_party/libwebrtc/modules/desktop_capture/linux/mouse_cursor_monitor_x11.cc", ++ "/third_party/libwebrtc/modules/desktop_capture/linux/screen_capturer_x11.cc", ++ "/third_party/libwebrtc/modules/desktop_capture/linux/shared_x_display.cc", ++ "/third_party/libwebrtc/modules/desktop_capture/linux/window_capturer_x11.cc", ++ "/third_party/libwebrtc/modules/desktop_capture/linux/window_finder_x11.cc", ++ "/third_party/libwebrtc/modules/desktop_capture/linux/window_list_utils.cc", ++ "/third_party/libwebrtc/modules/desktop_capture/linux/x_atom_cache.cc", ++ "/third_party/libwebrtc/modules/desktop_capture/linux/x_error_trap.cc", ++ "/third_party/libwebrtc/modules/desktop_capture/linux/x_server_pixel_buffer.cc", ++ "/third_party/libwebrtc/modules/desktop_capture/linux/x_window_property.cc" ++ ] + + if CONFIG["OS_TARGET"] == "OpenBSD": + +diff --git a/third_party/libwebrtc/modules/desktop_capture/desktop_capture_gn/moz.build b/third_party/libwebrtc/modules/desktop_capture/desktop_capture_gn/moz.build +index 4cf85ddfa7..e5873468ca 100644 +--- a/third_party/libwebrtc/modules/desktop_capture/desktop_capture_gn/moz.build ++++ b/third_party/libwebrtc/modules/desktop_capture/desktop_capture_gn/moz.build +@@ -53,10 +53,8 @@ if CONFIG["OS_TARGET"] == "Linux": + DEFINES["USE_NSS_CERTS"] = "1" + DEFINES["USE_OZONE"] = "1" + DEFINES["USE_UDEV"] = True +- DEFINES["USE_X11"] = "1" + DEFINES["WEBRTC_LINUX"] = True + DEFINES["WEBRTC_POSIX"] = True +- DEFINES["WEBRTC_USE_X11"] = True + DEFINES["_FILE_OFFSET_BITS"] = "64" + DEFINES["_GNU_SOURCE"] = True + DEFINES["_LARGEFILE64_SOURCE"] = True +@@ -67,14 +65,6 @@ if CONFIG["OS_TARGET"] == "Linux": + OS_LIBS += [ + "dl", + "rt", +- "X11", +- "Xcomposite", +- "Xdamage", +- "Xext", +- "Xfixes", +- "Xrandr", +- "Xrender", +- "Xtst" + ] + + if CONFIG["OS_TARGET"] == "OpenBSD": +diff --git a/third_party/libwebrtc/webrtc_gn/moz.build b/third_party/libwebrtc/webrtc_gn/moz.build +index 625bd0b5dd..2b0e2276c6 100644 +--- a/third_party/libwebrtc/webrtc_gn/moz.build ++++ b/third_party/libwebrtc/webrtc_gn/moz.build +@@ -71,7 +71,6 @@ if CONFIG["OS_TARGET"] == "Linux": + DEFINES["USE_NSS_CERTS"] = "1" + DEFINES["USE_OZONE"] = "1" + DEFINES["USE_UDEV"] = True +- DEFINES["USE_X11"] = "1" + DEFINES["WEBRTC_LINUX"] = True + DEFINES["WEBRTC_POSIX"] = True + DEFINES["_FILE_OFFSET_BITS"] = "64" +@@ -85,14 +84,6 @@ if CONFIG["OS_TARGET"] == "Linux": + "dl", + "m", + "rt", +- "X11", +- "Xcomposite", +- "Xdamage", +- "Xext", +- "Xfixes", +- "Xrandr", +- "Xrender", +- "Xtst" + ] + + if CONFIG["OS_TARGET"] == "OpenBSD": diff --git a/toolkit/components/remote/moz.build b/toolkit/components/remote/moz.build -index c1853a9f4d..b407dce197 100644 +index d3bab6cf9a..656b32c7fa 100644 --- a/toolkit/components/remote/moz.build +++ b/toolkit/components/remote/moz.build -@@ -16,6 +16,12 @@ if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk": - "nsUnixRemoteServer.cpp", - "RemoteUtils.cpp", - ] -+ if CONFIG["MOZ_X11"]: -+ SOURCES += [ -+ "nsGTKRemoteServer.cpp", -+ "nsXRemoteClient.cpp", -+ "nsXRemoteServer.cpp", -+ ] - if CONFIG["MOZ_ENABLE_DBUS"]: - SOURCES += [ - "nsDBusRemoteClient.cpp", -@@ -26,12 +32,6 @@ if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk": +@@ -26,7 +26,7 @@ if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk": "nsUnixRemoteServer.h", "RemoteUtils.h", ] - else: -- SOURCES += [ -- "nsGTKRemoteServer.cpp", -- "nsXRemoteClient.cpp", -- "nsXRemoteServer.cpp", -- ] - CXXFLAGS += CONFIG["TK_CFLAGS"] - - if CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows": ++ elif CONFIG["MOZ_X11"]: + SOURCES += [ + "nsGTKRemoteServer.cpp", + "nsXRemoteClient.cpp", diff --git a/toolkit/components/remote/nsRemoteService.cpp b/toolkit/components/remote/nsRemoteService.cpp -index b2499d8191..5448b8f4b4 100644 +index b2499d8191..1d1dc42e9f 100644 --- a/toolkit/components/remote/nsRemoteService.cpp +++ b/toolkit/components/remote/nsRemoteService.cpp -@@ -12,12 +12,17 @@ +@@ -12,12 +12,14 @@ #ifdef MOZ_WIDGET_GTK # include "mozilla/WidgetUtilsGtk.h" -# include "nsGTKRemoteServer.h" -+# ifdef MOZ_X11 -+# include "nsGTKRemoteServer.h" -+# include "nsXRemoteClient.h" -+# endif - # ifdef MOZ_ENABLE_DBUS +-# ifdef MOZ_ENABLE_DBUS ++# if defined(MOZ_ENABLE_DBUS) # include "nsDBusRemoteServer.h" # include "nsDBusRemoteClient.h" -# else --# include "nsXRemoteClient.h" -+# endif -+# ifdef MOZ_WAYLAND -+# include ++# elif defined(MOZ_X11) + # include "nsXRemoteClient.h" ++# include "nsGTKRemoteServer.h" ++# else +# include "nsRemoteClient.h" # endif #elif defined(XP_WIN) # include "nsWinRemoteServer.h" -@@ -99,10 +104,11 @@ RemoteResult nsRemoteService::StartClient(const char* aDesktopStartupID) { - } - - UniquePtr client; -+ return REMOTE_NOT_FOUND; +@@ -102,8 +104,10 @@ RemoteResult nsRemoteService::StartClient(const char* aDesktopStartupID) { #ifdef MOZ_WIDGET_GTK # if defined(MOZ_ENABLE_DBUS) client = MakeUnique(); -# else +# elif defined(MOZ_X11) client = MakeUnique(); ++# else ++ return REMOTE_NOT_FOUND; # endif #elif defined(XP_WIN) -@@ -143,10 +149,11 @@ void nsRemoteService::StartupServer() { - return; - } - -+ return; + client = MakeUnique(); +@@ -146,8 +150,10 @@ void nsRemoteService::StartupServer() { #ifdef MOZ_WIDGET_GTK # if defined(MOZ_ENABLE_DBUS) mRemoteServer = MakeUnique(); -# else +# elif defined(MOZ_X11) mRemoteServer = MakeUnique(); ++# else ++ return; # endif #elif defined(XP_WIN) + mRemoteServer = MakeUnique(); diff --git a/toolkit/moz.configure b/toolkit/moz.configure -index f63780b892..deadf892d6 100644 +index 539433a6ef..8599a3b838 100644 --- a/toolkit/moz.configure +++ b/toolkit/moz.configure -@@ -1170,34 +1170,6 @@ set_define("MOZ_RAW", depends_if("--enable-raw")(lambda _: True)) +@@ -286,7 +286,7 @@ def toolkit_choices(target): + elif target.os == "Android": + return ("cairo-android",) + else: +- return ("cairo-gtk3", "cairo-gtk3-wayland") ++ return ("cairo-gtk3",) + + + @depends(toolkit_choices) +@@ -338,23 +338,24 @@ def toolkit_gtk(toolkit): + + # Wayland support + # ============================================================== +-wayland_headers = pkg_check_modules( +- "MOZ_WAYLAND", +- "gtk+-wayland-3.0 >= 3.14 xkbcommon >= 0.4.1 libdrm >= 2.4", +- allow_missing=depends(full_toolkit)(lambda t: t == "cairo-gtk3"), +- when=depends(full_toolkit)(lambda t: t in ("cairo-gtk3", "cairo-gtk3-wayland")), ++option( ++ "--with-wayland", ++ help="{Enable wayland support|Disable wayland support}", + ) + +- +-@depends(wayland_headers, toolkit_gtk, artifact_builds) +-def wayland_headers(wayland, toolkit_gtk, artifacts): +- if toolkit_gtk and artifacts: ++@depends("--with-wayland", toolkit_gtk, artifact_builds) ++def with_wayland(value, toolkit_gtk, artifacts): ++ if value and toolkit_gtk or artifacts: + return True +- return wayland + ++wayland_headers = pkg_check_modules( ++ "MOZ_WAYLAND", ++ "gtk+-wayland-3.0 >= 3.14 xkbcommon >= 0.4.1 libdrm >= 2.4", ++ when=with_wayland, ++) + +-set_config("MOZ_WAYLAND", depends_if(wayland_headers)(lambda _: True)) +-set_define("MOZ_WAYLAND", depends_if(wayland_headers)(lambda _: True)) ++set_config("MOZ_WAYLAND", True, when=with_wayland) ++set_define("MOZ_WAYLAND", True, when=with_wayland) + + # GL Provider + # ============================================================== +@@ -376,7 +377,7 @@ def gl_provider_define(provider): + set_define("MOZ_GL_PROVIDER", gl_provider_define) + + +-@depends(gl_provider, wayland_headers, toolkit_gtk) ++@depends(gl_provider, with_wayland, toolkit_gtk) + def gl_default_provider(value, wayland, toolkit_gtk): + if value: + return value +@@ -1197,11 +1198,20 @@ set_define("MOZ_RAW", depends_if("--enable-raw")(lambda _: True)) # X11 # ============================================================== -set_config("MOZ_X11", True, when=toolkit_gtk) -set_define("MOZ_X11", True, when=toolkit_gtk) -- -- ++option( ++ "--with-x", ++ help="{Enable X11 support|Disable X11 support}", ++) ++ ++@depends("--with-x", toolkit_gtk) ++def with_x(value, toolkit_gtk): ++ if value and toolkit_gtk: ++ return True + ++set_config("MOZ_X11", True, when=with_x) ++set_define("MOZ_X11", True, when=with_x) + -@depends(webrtc, when=toolkit_gtk) --def x11_libs(webrtc): -- libs = [ -- "x11", -- "xcb", -- "xcb-shm", -- "x11-xcb", -- "xext", -- "xrandr >= 1.4.0", -- ] -- if webrtc: -- # third_party/libwebrtc/webrtc/webrtc_gn/moz.build adds those -- # manually, ensure they're available. -- libs += [ -- "xcomposite", -- "xcursor", -- "xdamage", -- "xfixes", -- "xi", -- ] -- return " ".join(libs) -- -- ++@depends(webrtc, when=with_x) + def x11_libs(webrtc): + libs = [ + "x11", +@@ -1225,8 +1235,8 @@ def x11_libs(webrtc): + return libs + + -pkg_check_modules("MOZ_X11", x11_libs, when=toolkit_gtk) +-pkg_check_modules("MOZ_X11_SM", ["ice", "sm"], cflags_only=True, when=toolkit_gtk) ++pkg_check_modules("MOZ_X11", x11_libs, when=with_x) ++pkg_check_modules("MOZ_X11_SM", ["ice", "sm"], cflags_only=True, when=with_x) # ASan Reporter Addon +diff --git a/toolkit/xre/moz.build b/toolkit/xre/moz.build +index b1e2b58621..576ec91669 100644 +--- a/toolkit/xre/moz.build ++++ b/toolkit/xre/moz.build +@@ -156,7 +156,7 @@ SOURCES += [ + "ProfileReset.cpp", + ] + +-if CONFIG["MOZ_X11"]: ++if CONFIG["MOZ_X11"] or CONFIG["MOZ_WAYLAND"]: + UNIFIED_SOURCES += [ + "glxtest.cpp", + ] +@@ -187,7 +187,7 @@ include("/ipc/chromium/chromium-config.mozbuild") + + FINAL_LIBRARY = "xul" + +-if CONFIG["MOZ_X11"]: ++if CONFIG["MOZ_X11"] or CONFIG["MOZ_WAYLAND"]: + DEFINES["USE_GLX_TEST"] = True + + for var in ( diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp -index 332f340179..070f3128e0 100644 +index ce001e9382..80d1694a11 100644 --- a/toolkit/xre/nsAppRunner.cpp +++ b/toolkit/xre/nsAppRunner.cpp -@@ -321,6 +321,7 @@ nsString gProcessStartupShortcut; - # endif - # ifdef MOZ_X11 - # include -+# undef None - # endif /* MOZ_X11 */ - # include +@@ -4116,6 +4116,7 @@ static void PR_CALLBACK ReadAheadDlls_ThreadStart(void* arg) { + + #if defined(MOZ_WAYLAND) + bool IsWaylandEnabled() { ++# ifdef MOZ_X11 + const char* waylandDisplay = PR_GetEnv("WAYLAND_DISPLAY"); + if (!waylandDisplay) { + return false; +@@ -4145,6 +4146,9 @@ bool IsWaylandEnabled() { + "Running Wayland backend on Gtk3 < 3.22. Expect issues/glitches"); + } + return enabled; ++# else ++ return true; ++# endif + } #endif -@@ -345,7 +346,6 @@ void XRE_LibFuzzerSetDriver(LibFuzzerDriver aDriver) { - #endif // FUZZING - // Undo X11/X.h's definition of None --#undef None - - namespace mozilla { - int (*RunGTest)(int*, char**) = 0; diff --git a/toolkit/xre/nsGDKErrorHandler.cpp b/toolkit/xre/nsGDKErrorHandler.cpp -index 421abdf12f..9335d2422c 100644 +index 421abdf12f..c7803cf973 100644 --- a/toolkit/xre/nsGDKErrorHandler.cpp +++ b/toolkit/xre/nsGDKErrorHandler.cpp -@@ -6,14 +6,21 @@ +@@ -6,14 +6,18 @@ #include "nsGDKErrorHandler.h" #include +-#include +#ifdef MOZ_X11 - #include -+#endif -+#ifdef MOZ_WAYLAND -+#include ++# include +#endif #include #include @@ -406,13 +479,14 @@ index 421abdf12f..9335d2422c 100644 #include "nsDebug.h" #include "nsString.h" +-#include "nsX11ErrorHandler.h" +#ifdef MOZ_X11 - #include "nsX11ErrorHandler.h" ++# include "nsX11ErrorHandler.h" +#endif #include "prenv.h" -@@ -26,6 +33,7 @@ +@@ -26,6 +30,7 @@ */ static void GdkErrorHandler(const gchar* log_domain, GLogLevelFlags log_level, const gchar* message, gpointer user_data) { @@ -420,20 +494,18 @@ index 421abdf12f..9335d2422c 100644 if (strstr(message, "X Window System error")) { XErrorEvent event; nsDependentCString buffer(message); -@@ -93,9 +101,12 @@ static void GdkErrorHandler(const gchar* log_domain, GLogLevelFlags log_level, - - X11Error(event.display, &event); - } else { -+#endif +@@ -96,6 +101,10 @@ static void GdkErrorHandler(const gchar* log_domain, GLogLevelFlags log_level, g_log_default_handler(log_domain, log_level, message, user_data); MOZ_CRASH_UNSAFE(message); -+#ifdef MOZ_X11 } ++#else ++ g_log_default_handler(log_domain, log_level, message, user_data); ++ MOZ_CRASH_UNSAFE(message); +#endif } void InstallGdkErrorHandler() { -@@ -103,7 +114,9 @@ void InstallGdkErrorHandler() { +@@ -103,7 +112,9 @@ void InstallGdkErrorHandler() { (GLogLevelFlags)(G_LOG_LEVEL_ERROR | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION), GdkErrorHandler, nullptr); @@ -444,50 +516,222 @@ index 421abdf12f..9335d2422c 100644 +#endif } diff --git a/widget/CompositorWidget.h b/widget/CompositorWidget.h -index 20eb3634f3..10fb94a99f 100644 +index 4d38bc6220..09e19945a9 100644 --- a/widget/CompositorWidget.h +++ b/widget/CompositorWidget.h @@ -62,7 +62,7 @@ class CompositorWidgetDelegate { }; // Platforms that support out-of-process widgets. --#if defined(XP_WIN) || defined(MOZ_X11) -+#if defined(XP_WIN) || defined(MOZ_X11) || defined(MOZ_WAYLAND) +-#if defined(XP_WIN) || defined(MOZ_X11) || defined(MOZ_WIDGET_ANDROID) ++#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_ANDROID) // CompositorWidgetParent should implement CompositorWidget and // PCompositorWidgetParent. class CompositorWidgetParent; +diff --git a/widget/gtk/GtkCompositorWidget.cpp b/widget/gtk/GtkCompositorWidget.cpp +index 89a8248bc0..2454006d0d 100644 +--- a/widget/gtk/GtkCompositorWidget.cpp ++++ b/widget/gtk/GtkCompositorWidget.cpp +@@ -49,9 +49,9 @@ GtkCompositorWidget::GtkCompositorWidget( + auto size = mClientSize.Lock(); + *size = aInitData.InitialClientSize(); + +- LOG("GtkCompositorWidget::GtkCompositorWidget() [%p] mXWindow %p " ++ LOG("GtkCompositorWidget::GtkCompositorWidget() [%p] aWindow %p " + "mIsRenderingSuspended %d\n", +- (void*)mWidget.get(), (void*)mXWindow, !!mIsRenderingSuspended); ++ (void*)mWidget.get(), (void*)aWindow, !!mIsRenderingSuspended); + } + + GtkCompositorWidget::~GtkCompositorWidget() { diff --git a/widget/gtk/MozContainer.cpp b/widget/gtk/MozContainer.cpp -index 95832dc03d..a21d2d2b40 100644 +index 95832dc03d..0d6585c2d4 100644 --- a/widget/gtk/MozContainer.cpp +++ b/widget/gtk/MozContainer.cpp -@@ -9,7 +9,9 @@ +@@ -9,7 +9,6 @@ #include #include -+#ifdef MOZ_X11 - #include -+#endif +-#include #include #include "mozilla/WidgetUtilsGtk.h" +diff --git a/widget/gtk/TaskbarProgress.cpp b/widget/gtk/TaskbarProgress.cpp +index 2aad109eab..396f39b5e7 100644 +--- a/widget/gtk/TaskbarProgress.cpp ++++ b/widget/gtk/TaskbarProgress.cpp +@@ -33,7 +33,6 @@ TaskbarProgress::~TaskbarProgress() { + NS_IMETHODIMP + TaskbarProgress::SetProgressState(nsTaskbarProgressState aState, + uint64_t aCurrentValue, uint64_t aMaxValue) { +-#ifdef MOZ_X11 + NS_ENSURE_ARG_RANGE(aState, 0, STATE_PAUSED); + + if (aState == STATE_NO_PROGRESS || aState == STATE_INDETERMINATE) { +@@ -72,7 +71,6 @@ TaskbarProgress::SetProgressState(nsTaskbarProgressState aState, + ("GtkTaskbarProgress::SetProgressState progress: %lu", progress)); + + mPrimaryWindow->SetProgress(progress); +-#endif + + return NS_OK; + } +diff --git a/widget/gtk/WindowSurfaceProvider.cpp b/widget/gtk/WindowSurfaceProvider.cpp +index 403af8e445..94ba1be0ff 100644 +--- a/widget/gtk/WindowSurfaceProvider.cpp ++++ b/widget/gtk/WindowSurfaceProvider.cpp +@@ -10,6 +10,7 @@ + #include "mozilla/gfx/Logging.h" + #include "mozilla/layers/LayersTypes.h" + #include "nsWindow.h" ++#include "WidgetUtilsGtk.h" + + #ifdef MOZ_WAYLAND + # include "mozilla/StaticPrefs_widget.h" diff --git a/widget/gtk/components.conf b/widget/gtk/components.conf -index 38c07bd812..a125d8d275 100644 +index 38c07bd812..8f2c10894a 100644 --- a/widget/gtk/components.conf +++ b/widget/gtk/components.conf -@@ -78,7 +78,7 @@ Classes = [ +@@ -76,53 +76,49 @@ Classes = [ + 'headers': ['/widget/gtk/nsApplicationChooser.h'], + 'processes': ProcessSelector.MAIN_PROCESS_ONLY, }, ++ { ++ 'name': 'GfxInfo', ++ 'cid': '{d755a760-9f27-11df-0800-200c9a664242}', ++ 'contract_ids': ['@mozilla.org/gfx/info;1'], ++ 'type': 'mozilla::widget::GfxInfo', ++ 'headers': ['/widget/gtk/GfxInfo.h'], ++ 'init_method': 'Init', ++ 'processes': ProcessSelector.ALLOW_IN_GPU_PROCESS, ++ }, ++ { ++ 'js_name': 'clipboard', ++ 'cid': '{8b5314ba-db01-11d2-96ce-0060b0fb9956}', ++ 'contract_ids': ['@mozilla.org/widget/clipboard;1'], ++ 'interfaces': ['nsIClipboard'], ++ 'type': 'nsIClipboard', ++ 'processes': ProcessSelector.MAIN_PROCESS_ONLY, ++ 'overridable': True, ++ }, ++ { ++ 'cid': '{77221d5a-1dd2-11b2-8c69-c710f15d2ed5}', ++ 'contract_ids': ['@mozilla.org/widget/clipboardhelper;1'], ++ 'type': 'nsClipboardHelper', ++ 'headers': ['/widget/nsClipboardHelper.h'], ++ }, ++ { ++ 'cid': '{8b5314bb-db01-11d2-96ce-0060b0fb9956}', ++ 'contract_ids': ['@mozilla.org/widget/dragservice;1'], ++ 'singleton': True, ++ 'type': 'nsDragService', ++ 'headers': ['/widget/gtk/nsDragService.h'], ++ 'constructor': 'nsDragService::GetInstance', ++ 'processes': ProcessSelector.MAIN_PROCESS_ONLY, ++ }, ++ { ++ 'cid': '{6987230e-0098-4e78-bc5f-1493ee7519fa}', ++ 'contract_ids': ['@mozilla.org/widget/useridleservice;1'], ++ 'singleton': True, ++ 'type': 'nsUserIdleService', ++ 'headers': ['/widget/gtk/nsUserIdleServiceGTK.h'], ++ 'constructor': 'nsUserIdleServiceGTK::GetInstance', ++ }, ] -if defined('MOZ_X11'): -+if defined('MOZ_X11') or defined('MOZ_WAYLAND'): +- Classes += [ +- { +- 'js_name': 'clipboard', +- 'cid': '{8b5314ba-db01-11d2-96ce-0060b0fb9956}', +- 'contract_ids': ['@mozilla.org/widget/clipboard;1'], +- 'interfaces': ['nsIClipboard'], +- 'type': 'nsIClipboard', +- 'processes': ProcessSelector.MAIN_PROCESS_ONLY, +- 'overridable': True, +- }, +- { +- 'cid': '{77221d5a-1dd2-11b2-8c69-c710f15d2ed5}', +- 'contract_ids': ['@mozilla.org/widget/clipboardhelper;1'], +- 'type': 'nsClipboardHelper', +- 'headers': ['/widget/nsClipboardHelper.h'], +- }, +- { +- 'cid': '{8b5314bb-db01-11d2-96ce-0060b0fb9956}', +- 'contract_ids': ['@mozilla.org/widget/dragservice;1'], +- 'singleton': True, +- 'type': 'nsDragService', +- 'headers': ['/widget/gtk/nsDragService.h'], +- 'constructor': 'nsDragService::GetInstance', +- 'processes': ProcessSelector.MAIN_PROCESS_ONLY, +- }, +- { +- 'name': 'GfxInfo', +- 'cid': '{d755a760-9f27-11df-0800-200c9a664242}', +- 'contract_ids': ['@mozilla.org/gfx/info;1'], +- 'type': 'mozilla::widget::GfxInfo', +- 'headers': ['/widget/gtk/GfxInfo.h'], +- 'init_method': 'Init', +- 'processes': ProcessSelector.ALLOW_IN_GPU_PROCESS, +- }, +- { +- 'cid': '{6987230e-0098-4e78-bc5f-1493ee7519fa}', +- 'contract_ids': ['@mozilla.org/widget/useridleservice;1'], +- 'singleton': True, +- 'type': 'nsUserIdleService', +- 'headers': ['/widget/gtk/nsUserIdleServiceGTK.h'], +- 'constructor': 'nsUserIdleServiceGTK::GetInstance', +- }, +- ] +- + if defined('NS_PRINTING'): Classes += [ { - 'js_name': 'clipboard', +diff --git a/widget/x11/keysym2ucs.c b/widget/gtk/keysym2ucs.c +similarity index 100% +rename from widget/x11/keysym2ucs.c +rename to widget/gtk/keysym2ucs.c +diff --git a/widget/x11/keysym2ucs.h b/widget/gtk/keysym2ucs.h +similarity index 100% +rename from widget/x11/keysym2ucs.h +rename to widget/gtk/keysym2ucs.h diff --git a/widget/gtk/moz.build b/widget/gtk/moz.build -index 291e3a78c8..7955b84d0c 100644 +index 1d82fc36c2..98af9fca3d 100644 --- a/widget/gtk/moz.build +++ b/widget/gtk/moz.build -@@ -101,22 +101,26 @@ if CONFIG["MOZ_WAYLAND"]: +@@ -34,15 +34,23 @@ EXPORTS += [ + EXPORTS.mozilla += ["WidgetUtilsGtk.h"] + + EXPORTS.mozilla.widget += [ ++ "CompositorWidgetChild.h", ++ "CompositorWidgetParent.h", ++ "GtkCompositorWidget.h", ++ "InProcessGtkCompositorWidget.h", + "WindowSurface.h", + "WindowSurfaceProvider.h", + ] + + UNIFIED_SOURCES += [ ++ "CompositorWidgetChild.cpp", ++ "CompositorWidgetParent.cpp", + "GfxInfo.cpp", + "gtk3drawing.cpp", + "GtkCompositorWidget.cpp", + "IMContextWrapper.cpp", ++ "InProcessGtkCompositorWidget.cpp", ++ "keysym2ucs.c", + "MozContainer.cpp", + "MPRISServiceHandler.cpp", + "NativeKeyBindings.cpp", +@@ -58,6 +66,7 @@ UNIFIED_SOURCES += [ + "nsLookAndFeel.cpp", + "nsSound.cpp", + "nsToolkit.cpp", ++ "nsUserIdleServiceGTK.cpp", + "nsWidgetFactory.cpp", + "ScreenHelperGTK.cpp", + "TaskbarProgress.cpp", +@@ -101,22 +110,12 @@ if CONFIG["MOZ_WAYLAND"]: if CONFIG["MOZ_X11"]: UNIFIED_SOURCES += [ @@ -507,80 +751,76 @@ index 291e3a78c8..7955b84d0c 100644 - "GtkCompositorWidget.h", - "InProcessGtkCompositorWidget.h", - ] -+ -+UNIFIED_SOURCES += [ -+ "CompositorWidgetChild.cpp", -+ "CompositorWidgetParent.cpp", -+ "InProcessGtkCompositorWidget.cpp", -+ "nsUserIdleServiceGTK.cpp", -+] -+ -+EXPORTS.mozilla.widget += [ -+ "CompositorWidgetChild.h", -+ "CompositorWidgetParent.h", -+ "GtkCompositorWidget.h", -+ "InProcessGtkCompositorWidget.h", -+] if CONFIG["NS_PRINTING"]: UNIFIED_SOURCES += [ -@@ -145,7 +149,7 @@ LOCAL_INCLUDES += [ - "/widget/headless", - ] - --if CONFIG["MOZ_X11"]: -+if CONFIG["MOZ_X11"] or CONFIG["MOZ_WAYLAND"]: - LOCAL_INCLUDES += [ - "/widget/x11", - ] diff --git a/widget/gtk/mozgtk/mozgtk.c b/widget/gtk/mozgtk/mozgtk.c -index 677f9b3561..b8cb7de58e 100644 +index 677f9b3561..e375cab31f 100644 --- a/widget/gtk/mozgtk/mozgtk.c +++ b/widget/gtk/mozgtk/mozgtk.c -@@ -6,6 +6,7 @@ +@@ -6,16 +6,4 @@ #include "mozilla/Types.h" -+#if defined(MOZ_X11) - #include - // Bug 1271100 - // We need to trick system Cairo into not using the XShm extension due to -@@ -19,3 +20,4 @@ - // ever can remove this workaround for system Cairo, we'll need something - // to replace it for that purpose. - MOZ_EXPORT Bool XShmQueryExtension(Display* aDisplay) { return False; } -+#endif +-#include +-// Bug 1271100 +-// We need to trick system Cairo into not using the XShm extension due to +-// a race condition in it that results in frequent BadAccess errors. Cairo +-// relies upon XShmQueryExtension to initially detect if XShm is available. +-// So we define our own stub that always indicates XShm not being present. +-// mozgtk loads before libXext/libcairo and so this stub will take priority. +-// Our tree usage goes through xcb and remains unaffected by this. +-// +-// This is also used to force libxul to depend on the mozgtk library. If we +-// ever can remove this workaround for system Cairo, we'll need something +-// to replace it for that purpose. +-MOZ_EXPORT Bool XShmQueryExtension(Display* aDisplay) { return False; } ++MOZ_EXPORT void PleaseLinkWithMe() {} +diff --git a/widget/gtk/mozwayland/mozwayland.c b/widget/gtk/mozwayland/mozwayland.c +index 1a86468b4f..eee67ed3a9 100644 +--- a/widget/gtk/mozwayland/mozwayland.c ++++ b/widget/gtk/mozwayland/mozwayland.c +@@ -8,7 +8,6 @@ + #include + #include "mozilla/Types.h" + #include +-#include + #include + + union wl_argument; diff --git a/widget/gtk/nsClipboard.cpp b/widget/gtk/nsClipboard.cpp -index 48160b39a4..5b99ba942a 100644 +index 8fdd8e38dc..ea0eaae2de 100644 --- a/widget/gtk/nsClipboard.cpp +++ b/widget/gtk/nsClipboard.cpp @@ -9,7 +9,9 @@ #include "nsArrayUtils.h" #include "nsClipboard.h" +-#include "nsClipboardX11.h" +#if defined(MOZ_X11) - #include "nsClipboardX11.h" ++# include "nsClipboardX11.h" +#endif #if defined(MOZ_WAYLAND) # include "nsClipboardWayland.h" # include "nsClipboardWaylandAsync.h" -@@ -33,7 +35,9 @@ +@@ -37,7 +39,6 @@ #include "imgIContainer.h" #include -+#ifdef MOZ_X11 - #include -+#endif +-#include #include "mozilla/Encoding.h" -@@ -102,16 +106,12 @@ nsClipboard::~nsClipboard() { +@@ -106,17 +107,21 @@ nsClipboard::~nsClipboard() { NS_IMPL_ISUPPORTS(nsClipboard, nsIClipboard, nsIObserver) nsresult nsClipboard::Init(void) { -- if (widget::GdkIsX11Display()) { -- mContext = new nsRetrievalContextX11(); --#if defined(MOZ_WAYLAND) ++#if defined(MOZ_X11) + if (widget::GdkIsX11Display()) { + mContext = new nsRetrievalContextX11(); ++ } ++#endif + #if defined(MOZ_WAYLAND) - } else if (widget::GdkIsWaylandDisplay()) { + if (widget::GdkIsWaylandDisplay()) { if (StaticPrefs::widget_wayland_async_clipboard_enabled_AtStartup()) { @@ -588,82 +828,26 @@ index 48160b39a4..5b99ba942a 100644 } else { mContext = new nsRetrievalContextWayland(); } --#endif - } else { ++ } + #endif +- } else { ++ if (!mContext) { NS_WARNING("Missing nsRetrievalContext for nsClipboard!"); return NS_OK; -@@ -347,14 +347,6 @@ nsClipboard::GetData(nsITransferable* aTransferable, int32_t aWhichClipboard) { } - #endif - -- // Filter out MIME types on X11 to prevent unwanted conversions, -- // see Bug 1611407 -- if (widget::GdkIsX11Display()) { -- if (!FilterImportedFlavors(aWhichClipboard, flavors)) { -- return NS_OK; -- } -- } -- - for (uint32_t i = 0; i < flavors.Length(); i++) { - nsCString& flavorStr = flavors[i]; - -diff --git a/widget/gtk/nsDeviceContextSpecG.cpp b/widget/gtk/nsDeviceContextSpecG.cpp -index 3948c15cc5..968252b896 100644 ---- a/widget/gtk/nsDeviceContextSpecG.cpp -+++ b/widget/gtk/nsDeviceContextSpecG.cpp -@@ -6,7 +6,9 @@ - #include "nsDeviceContextSpecG.h" - - #include "mozilla/gfx/PrintTargetPDF.h" -+#ifdef MOZ_X11 - #include "mozilla/gfx/PrintTargetPS.h" -+#endif - #include "mozilla/Logging.h" - #include "mozilla/Services.h" - -@@ -46,7 +48,9 @@ using namespace mozilla; - using mozilla::gfx::IntSize; - using mozilla::gfx::PrintTarget; - using mozilla::gfx::PrintTargetPDF; -+#ifdef MOZ_X11 - using mozilla::gfx::PrintTargetPS; -+#endif - - nsDeviceContextSpecGTK::nsDeviceContextSpecGTK() - : mGtkPrintSettings(nullptr), mGtkPageSetup(nullptr) {} -@@ -119,12 +123,15 @@ already_AddRefed nsDeviceContextSpecGTK::MakePrintTarget() { - return PrintTargetPDF::CreateOrNull(stream, size); - } - -+#ifdef MOZ_X11 - int32_t orientation = mPrintSettings->GetSheetOrientation(); - return PrintTargetPS::CreateOrNull( - stream, size, - orientation == nsIPrintSettings::kPortraitOrientation - ? PrintTargetPS::PORTRAIT - : PrintTargetPS::LANDSCAPE); -+#endif -+ return nullptr; - } - - #define DECLARE_KNOWN_MONOCHROME_SETTING(key_, value_) {"cups-" key_, value_}, diff --git a/widget/gtk/nsDragService.cpp b/widget/gtk/nsDragService.cpp -index fcd4236261..659c06260c 100644 +index ea57c4f3c0..5355fbe467 100644 --- a/widget/gtk/nsDragService.cpp +++ b/widget/gtk/nsDragService.cpp -@@ -23,7 +23,11 @@ +@@ -23,7 +23,6 @@ #include "prthread.h" #include #include -+#ifdef MOZ_X11 - #include -+#else -+#include -+#endif +-#include #include "nsCRT.h" #include "mozilla/BasicEvents.h" #include "mozilla/Services.h" -@@ -34,7 +38,6 @@ +@@ -34,7 +33,6 @@ #include "mozilla/WidgetUtilsGtk.h" #include "GRefPtr.h" @@ -671,43 +855,50 @@ index fcd4236261..659c06260c 100644 #include "gfxContext.h" #include "nsImageToPixbuf.h" #include "nsPresContext.h" -@@ -52,6 +55,8 @@ - #ifdef MOZ_WAYLAND - # include "nsClipboardWayland.h" - # include "gfxPlatformGtk.h" -+#else -+#include "gfxXlibSurface.h" - #endif - - using namespace mozilla; diff --git a/widget/gtk/nsGtkKeyUtils.cpp b/widget/gtk/nsGtkKeyUtils.cpp -index f4c7030a37..a54d14988f 100644 +index 5f971b721a..d948ae58bf 100644 --- a/widget/gtk/nsGtkKeyUtils.cpp +++ b/widget/gtk/nsGtkKeyUtils.cpp -@@ -12,10 +12,12 @@ +@@ -12,15 +12,16 @@ #include #include #include -#include ++#ifdef MOZ_X11 ++# include ++# include ++# include "X11UndefineNone.h" ++#endif #include #include -+#ifdef MOZ_X11 -+#include - #include -+#endif - #include "X11UndefineNone.h" +-#include +-#include "X11UndefineNone.h" #include "IMContextWrapper.h" #include "WidgetUtils.h" -@@ -51,7 +53,7 @@ LazyLogModule gKeymapWrapperLog("KeymapWrapperWidgets"); + #include "WidgetUtilsGtk.h" +-#include "keysym2ucs.h" + #include "nsContentUtils.h" + #include "nsGtkUtils.h" + #include "nsIBidiKeyboard.h" +@@ -28,6 +29,7 @@ + #include "nsReadableUtils.h" + #include "nsServiceManagerUtils.h" + #include "nsWindow.h" ++#include "keysym2ucs.h" + + #include "mozilla/ArrayUtils.h" + #include "mozilla/MouseEvents.h" +@@ -55,7 +57,9 @@ namespace widget { KeymapWrapper* KeymapWrapper::sInstance = nullptr; guint KeymapWrapper::sLastRepeatableHardwareKeyCode = 0; --Time KeymapWrapper::sLastRepeatableKeyTime = 0; -+GTime KeymapWrapper::sLastRepeatableKeyTime = 0; ++#ifdef MOZ_X11 + Time KeymapWrapper::sLastRepeatableKeyTime = 0; ++#endif KeymapWrapper::RepeatState KeymapWrapper::sRepeatState = KeymapWrapper::NOT_PRESSED; -@@ -346,9 +348,11 @@ KeymapWrapper::KeymapWrapper() +@@ -354,9 +358,11 @@ KeymapWrapper::KeymapWrapper() g_object_ref(mGdkKeymap); @@ -719,30 +910,29 @@ index f4c7030a37..a54d14988f 100644 Init(); } -@@ -365,16 +369,19 @@ void KeymapWrapper::Init() { +@@ -373,17 +379,18 @@ void KeymapWrapper::Init() { mModifierKeys.Clear(); memset(mModifierMasks, 0, sizeof(mModifierMasks)); +#ifdef MOZ_X11 if (GdkIsX11Display()) { InitBySystemSettingsX11(); -- } -+ } else { + } ++ gdk_window_add_filter(nullptr, FilterEvents, this); +#endif #ifdef MOZ_WAYLAND - else { ++ if (GdkIsWaylandDisplay()) { InitBySystemSettingsWayland(); -- } + } #endif -+#ifdef MOZ_X11 -+ } - gdk_window_add_filter(nullptr, FilterEvents, this); -+#endif - - MOZ_LOG(gKeymapWrapperLog, LogLevel::Info, +- gdk_window_add_filter(nullptr, FilterEvents, this); +- + MOZ_LOG(gKeyLog, LogLevel::Info, ("%p Init, CapsLock=0x%X, NumLock=0x%X, " -@@ -387,6 +394,7 @@ void KeymapWrapper::Init() { + "ScrollLock=0x%X, Level3=0x%X, Level5=0x%X, " +@@ -395,6 +402,7 @@ void KeymapWrapper::Init() { GetModifierMask(SUPER), GetModifierMask(HYPER))); } @@ -750,7 +940,7 @@ index f4c7030a37..a54d14988f 100644 void KeymapWrapper::InitXKBExtension() { PodZero(&mKeyboardState); -@@ -619,6 +627,7 @@ void KeymapWrapper::InitBySystemSettingsX11() { +@@ -626,6 +634,7 @@ void KeymapWrapper::InitBySystemSettingsX11() { XFreeModifiermap(xmodmap); XFree(xkeymap); } @@ -758,7 +948,7 @@ index f4c7030a37..a54d14988f 100644 #ifdef MOZ_WAYLAND void KeymapWrapper::SetModifierMask(xkb_keymap* aKeymap, -@@ -776,7 +785,9 @@ void KeymapWrapper::InitBySystemSettingsWayland() { +@@ -789,7 +798,9 @@ void KeymapWrapper::InitBySystemSettingsWayland() { #endif KeymapWrapper::~KeymapWrapper() { @@ -768,15 +958,15 @@ index f4c7030a37..a54d14988f 100644 if (mOnKeysChangedSignalHandle) { g_signal_handler_disconnect(mGdkKeymap, mOnKeysChangedSignalHandle); } -@@ -787,6 +798,7 @@ KeymapWrapper::~KeymapWrapper() { - MOZ_LOG(gKeymapWrapperLog, LogLevel::Info, ("%p Destructor", this)); +@@ -800,6 +811,7 @@ KeymapWrapper::~KeymapWrapper() { + MOZ_LOG(gKeyLog, LogLevel::Info, ("%p Destructor", this)); } +#ifdef MOZ_X11 /* static */ GdkFilterReturn KeymapWrapper::FilterEvents(GdkXEvent* aXEvent, GdkEvent* aGdkEvent, -@@ -900,6 +912,7 @@ GdkFilterReturn KeymapWrapper::FilterEvents(GdkXEvent* aXEvent, +@@ -913,6 +925,7 @@ GdkFilterReturn KeymapWrapper::FilterEvents(GdkXEvent* aXEvent, return GDK_FILTER_CONTINUE; } @@ -784,7 +974,7 @@ index f4c7030a37..a54d14988f 100644 static void ResetBidiKeyboard() { // Reset the bidi keyboard settings for the new GdkKeymap -@@ -1760,6 +1773,7 @@ void KeymapWrapper::InitKeyEvent(WidgetKeyboardEvent& aKeyEvent, +@@ -1773,6 +1786,7 @@ void KeymapWrapper::InitKeyEvent(WidgetKeyboardEvent& aKeyEvent, // state. It means if there're some pending modifier key press or // key release events, the result isn't what we want. guint modifierState = aGdkKeyEvent->state; @@ -792,7 +982,7 @@ index f4c7030a37..a54d14988f 100644 GdkDisplay* gdkDisplay = gdk_display_get_default(); if (aGdkKeyEvent->is_modifier && GdkIsX11Display(gdkDisplay)) { Display* display = gdk_x11_display_get_xdisplay(gdkDisplay); -@@ -1777,6 +1791,7 @@ void KeymapWrapper::InitKeyEvent(WidgetKeyboardEvent& aKeyEvent, +@@ -1790,6 +1804,7 @@ void KeymapWrapper::InitKeyEvent(WidgetKeyboardEvent& aKeyEvent, } } } @@ -800,7 +990,7 @@ index f4c7030a37..a54d14988f 100644 InitInputEvent(aKeyEvent, modifierState); switch (aGdkKeyEvent->keyval) { -@@ -2023,6 +2038,7 @@ bool KeymapWrapper::IsLatinGroup(guint8 aGroup) { +@@ -2036,6 +2051,7 @@ bool KeymapWrapper::IsLatinGroup(guint8 aGroup) { return result; } @@ -808,7 +998,7 @@ index f4c7030a37..a54d14988f 100644 bool KeymapWrapper::IsAutoRepeatableKey(guint aHardwareKeyCode) { uint8_t indexOfArray = aHardwareKeyCode / 8; MOZ_ASSERT(indexOfArray < ArrayLength(mKeyboardState.auto_repeats), -@@ -2030,6 +2046,7 @@ bool KeymapWrapper::IsAutoRepeatableKey(guint aHardwareKeyCode) { +@@ -2043,6 +2059,7 @@ bool KeymapWrapper::IsAutoRepeatableKey(guint aHardwareKeyCode) { char bitMask = 1 << (aHardwareKeyCode % 8); return (mKeyboardState.auto_repeats[indexOfArray] & bitMask) != 0; } @@ -817,55 +1007,93 @@ index f4c7030a37..a54d14988f 100644 /* static */ bool KeymapWrapper::IsBasicLatinLetterOrNumeral(uint32_t aCharCode) { diff --git a/widget/gtk/nsGtkKeyUtils.h b/widget/gtk/nsGtkKeyUtils.h -index 07d60c27a6..43df8095fd 100644 +index 18188c9b00..59a61752bb 100644 --- a/widget/gtk/nsGtkKeyUtils.h +++ b/widget/gtk/nsGtkKeyUtils.h -@@ -13,7 +13,9 @@ +@@ -12,8 +12,10 @@ + #include "nsIWidget.h" #include "nsTArray.h" - #include +-#include +-#include +#ifdef MOZ_X11 - #include ++# include ++# include +#endif #ifdef MOZ_WAYLAND # include # include -@@ -315,7 +317,9 @@ class KeymapWrapper { - * See a call of XkbSelectEventDetails() with XkbControlsNotify in +@@ -248,8 +250,10 @@ class KeymapWrapper { + * Initializing methods. + */ + void Init(); ++#ifdef MOZ_X11 + void InitXKBExtension(); + void InitBySystemSettingsX11(); ++#endif + #ifdef MOZ_WAYLAND + void InitBySystemSettingsWayland(); + #endif +@@ -325,6 +329,7 @@ class KeymapWrapper { + */ + int mXKBBaseEventCode; + ++#ifdef MOZ_X11 + /** + * Only auto_repeats[] stores valid value. If you need to use other + * members, you need to listen notification events for them. +@@ -332,6 +337,7 @@ class KeymapWrapper { * InitXKBExtension(). */ -+#ifdef MOZ_X11 XKeyboardState mKeyboardState; +#endif /** * Pointer of the singleton instance. -@@ -326,7 +330,7 @@ class KeymapWrapper { +@@ -342,15 +348,19 @@ class KeymapWrapper { * Auto key repeat management. */ static guint sLastRepeatableHardwareKeyCode; -- static Time sLastRepeatableKeyTime; -+ static GTime sLastRepeatableKeyTime; ++#ifdef MOZ_X11 + static Time sLastRepeatableKeyTime; ++#endif enum RepeatState { NOT_PRESSED, FIRST_PRESS, REPEATING }; static RepeatState sRepeatState; ++#ifdef MOZ_X11 + /** + * IsAutoRepeatableKey() returns true if the key supports auto repeat. + * Otherwise, false. + */ + bool IsAutoRepeatableKey(guint aHardwareKeyCode); ++#endif + + /** + * Signal handlers. diff --git a/widget/gtk/nsPrintDialogGTK.cpp b/widget/gtk/nsPrintDialogGTK.cpp -index 0050af3af3..c2c02e59ff 100644 +index 8fb56543b7..9a562eb124 100644 --- a/widget/gtk/nsPrintDialogGTK.cpp +++ b/widget/gtk/nsPrintDialogGTK.cpp -@@ -26,7 +26,11 @@ +@@ -5,6 +5,9 @@ + + #include + #include ++#ifdef MOZ_X11 ++# include ++#endif + #include + + #include "mozilla/ArrayUtils.h" +@@ -27,8 +30,6 @@ + #include "WidgetUtilsGtk.h" #include "nsIObserverService.h" - // for gdk_x11_window_get_xid -+#ifdef MOZ_X11 - #include -+#else -+#include -+#endif +-// for gdk_x11_window_get_xid +-#include #include #include #include -@@ -525,6 +529,7 @@ static void wayland_window_handle_exported(GdkWindow* window, +@@ -527,6 +528,7 @@ static void wayland_window_handle_exported(GdkWindow* window, static gboolean window_export_handle(GtkWindow* window, GtkWindowHandleExported callback, gpointer user_data) { @@ -873,7 +1101,7 @@ index 0050af3af3..c2c02e59ff 100644 if (GdkIsX11Display()) { GdkWindow* gdk_window = gtk_widget_get_window(GTK_WIDGET(window)); char* handle_str; -@@ -535,8 +540,9 @@ static gboolean window_export_handle(GtkWindow* window, +@@ -537,8 +539,9 @@ static gboolean window_export_handle(GtkWindow* window, g_free(handle_str); return true; } @@ -885,18 +1113,19 @@ index 0050af3af3..c2c02e59ff 100644 WaylandWindowHandleExportedData* data; diff --git a/widget/gtk/nsUserIdleServiceGTK.cpp b/widget/gtk/nsUserIdleServiceGTK.cpp -index 884d52a6ca..89bdc16b1a 100644 +index 884d52a6ca..4b2b04f09a 100644 --- a/widget/gtk/nsUserIdleServiceGTK.cpp +++ b/widget/gtk/nsUserIdleServiceGTK.cpp -@@ -17,6 +17,7 @@ using mozilla::LogLevel; +@@ -17,6 +17,8 @@ using mozilla::LogLevel; static mozilla::LazyLogModule sIdleLog("nsIUserIdleService"); +#ifdef MOZ_X11 ++ typedef bool (*_XScreenSaverQueryExtension_fn)(Display* dpy, int* event_base, int* error_base); -@@ -25,12 +26,14 @@ typedef XScreenSaverInfo* (*_XScreenSaverAllocInfo_fn)(void); +@@ -25,16 +27,20 @@ typedef XScreenSaverInfo* (*_XScreenSaverAllocInfo_fn)(void); typedef void (*_XScreenSaverQueryInfo_fn)(Display* dpy, Drawable drw, XScreenSaverInfo* info); @@ -904,30 +1133,31 @@ index 884d52a6ca..89bdc16b1a 100644 static _XScreenSaverQueryExtension_fn _XSSQueryExtension = nullptr; static _XScreenSaverAllocInfo_fn _XSSAllocInfo = nullptr; static _XScreenSaverQueryInfo_fn _XSSQueryInfo = nullptr; -+#endif -+static bool sInitialized = false; ++#endif ++ ++static bool sInitialized = false; ++ static void Initialize() { -+#ifdef MOZ_X11 if (!mozilla::widget::GdkIsX11Display()) { return; } -@@ -58,15 +61,22 @@ static void Initialize() { - if (!_XSSQueryInfo) + ++#ifdef MOZ_X11 + // This will leak - See comments in ~nsUserIdleServiceGTK(). + PRLibrary* xsslib = PR_LoadLibrary("libXss.so.1"); + if (!xsslib) // ouch. +@@ -59,14 +65,15 @@ static void Initialize() { MOZ_LOG(sIdleLog, LogLevel::Warning, ("Failed to get XSSQueryInfo!\n")); -+#endif sInitialized = true; ++#endif } -nsUserIdleServiceGTK::nsUserIdleServiceGTK() : mXssInfo(nullptr) { -+nsUserIdleServiceGTK::nsUserIdleServiceGTK() -+#ifdef MOZ_X11 -+: mXssInfo(nullptr) -+#endif -+{ - Initialize(); - } +- Initialize(); +-} ++nsUserIdleServiceGTK::nsUserIdleServiceGTK() { Initialize(); } nsUserIdleServiceGTK::~nsUserIdleServiceGTK() { +#ifdef MOZ_X11 @@ -936,35 +1166,42 @@ index 884d52a6ca..89bdc16b1a 100644 // It is not safe to unload libXScrnSaver until each display is closed because // the library registers callbacks through XESetCloseDisplay (Bug 397607). -@@ -88,6 +98,7 @@ bool nsUserIdleServiceGTK::PollIdleTime(uint32_t* aIdleTime) { +@@ -84,6 +91,7 @@ bool nsUserIdleServiceGTK::PollIdleTime(uint32_t* aIdleTime) { + // For some reason, we could not find xscreensaver. + return false; + } ++#ifdef MOZ_X11 + // Ask xscreensaver about idle time: *aIdleTime = 0; - -+#ifdef MOZ_X11 - // We might not have a display (cf. in xpcshell) - Display* dplay = GDK_DISPLAY_XDISPLAY(gdk_display_get_default()); - if (!dplay) { -@@ -107,6 +118,7 @@ bool nsUserIdleServiceGTK::PollIdleTime(uint32_t* aIdleTime) { - *aIdleTime = mXssInfo->idle; - return true; +@@ -109,6 +117,7 @@ bool nsUserIdleServiceGTK::PollIdleTime(uint32_t* aIdleTime) { } -+#endif // If we get here, we couldn't get to XScreenSaver: MOZ_LOG(sIdleLog, LogLevel::Warning, ("XSSQueryExtension returned false!\n")); ++#endif return false; + } + diff --git a/widget/gtk/nsUserIdleServiceGTK.h b/widget/gtk/nsUserIdleServiceGTK.h -index 9b9ba31846..8f83aee584 100644 +index 9b9ba31846..f089f3b87d 100644 --- a/widget/gtk/nsUserIdleServiceGTK.h +++ b/widget/gtk/nsUserIdleServiceGTK.h -@@ -9,6 +9,7 @@ +@@ -9,9 +9,11 @@ #define nsUserIdleServiceGTK_h__ #include "nsUserIdleService.h" +-#include +-#include +-#include ++ +#ifdef MOZ_X11 - #include - #include - #include -@@ -21,6 +22,7 @@ typedef struct { ++# include ++# include ++# include + + typedef struct { + Window window; // Screen saver window +@@ -21,6 +23,7 @@ typedef struct { unsigned long idle; // milliseconds idle unsigned long event_mask; // event stuff } XScreenSaverInfo; @@ -972,12 +1209,13 @@ index 9b9ba31846..8f83aee584 100644 class nsUserIdleServiceGTK : public nsUserIdleService { public: -@@ -40,7 +42,9 @@ class nsUserIdleServiceGTK : public nsUserIdleService { +@@ -40,7 +43,9 @@ class nsUserIdleServiceGTK : public nsUserIdleService { private: ~nsUserIdleServiceGTK(); +- XScreenSaverInfo* mXssInfo; +#ifdef MOZ_X11 - XScreenSaverInfo* mXssInfo; ++ XScreenSaverInfo* mXssInfo = nullptr; +#endif protected: @@ -1014,7 +1252,7 @@ index d649c7e0bf..70b47d5124 100644 nsresult nsWidgetGtk2ModuleCtor() { return nsAppShellInit(); } diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp -index aec5588fae..2df8558a4f 100644 +index 59e01f0fea..12bdda1cd4 100644 --- a/widget/gtk/nsWindow.cpp +++ b/widget/gtk/nsWindow.cpp @@ -58,7 +58,6 @@ @@ -1033,41 +1271,37 @@ index aec5588fae..2df8558a4f 100644 #ifdef ACCESSIBILITY # include "mozilla/a11y/LocalAccessible.h" -@@ -98,18 +96,22 @@ - # include "nsAccessibilityService.h" - #endif - -+#include "GLContextEGL.h" -+#include "GtkCompositorWidget.h" - #ifdef MOZ_X11 -+# include "mozilla/X11Util.h" - # include - # include - # include - # include - # include "gfxXlibSurface.h" - # include "GLContextGLX.h" // for GLContextGLX::FindVisual() --# include "GLContextEGL.h" // for GLContextEGL::FindVisual() +@@ -108,6 +106,9 @@ + # include "GLContextEGL.h" // for GLContextEGL::FindVisual() # include "WindowSurfaceX11Image.h" # include "WindowSurfaceX11SHM.h" ++# include "mozilla/X11Util.h" ++using mozilla::gl::GLContextEGL; ++using mozilla::gl::GLContextGLX; #endif #ifdef MOZ_WAYLAND -+# include -+# include # include "nsIClipboard.h" - # include "nsView.h" - #endif -@@ -119,7 +121,9 @@ using namespace mozilla::gfx; +@@ -118,8 +119,6 @@ using namespace mozilla; + using namespace mozilla::gfx; using namespace mozilla::layers; using namespace mozilla::widget; - using mozilla::gl::GLContextEGL; -+#ifdef MOZ_X11 - using mozilla::gl::GLContextGLX; -+#endif +-using mozilla::gl::GLContextEGL; +-using mozilla::gl::GLContextGLX; // Don't put more than this many rects in the dirty region, just fluff // out to the bounding-box if there are more -@@ -278,6 +282,7 @@ bool nsWindow::sTransparentMainWindow = false; +@@ -267,15 +266,18 @@ static nsresult initialize_prefs(void); + static guint32 sLastUserInputTime = GDK_CURRENT_TIME; + static guint32 sRetryGrabTime; + ++#ifdef MOZ_X11 + static SystemTimeConverter& TimeConverter() { + static SystemTimeConverter sTimeConverterSingleton; + return sTimeConverterSingleton; + } ++#endif + + bool nsWindow::sTransparentMainWindow = false; namespace mozilla { @@ -1075,7 +1309,7 @@ index aec5588fae..2df8558a4f 100644 class CurrentX11TimeGetter { public: explicit CurrentX11TimeGetter(GdkWindow* aWindow) -@@ -325,6 +330,7 @@ class CurrentX11TimeGetter { +@@ -323,6 +325,7 @@ class CurrentX11TimeGetter { GdkWindow* mWindow; TimeStamp mAsyncUpdateStart; }; @@ -1083,67 +1317,40 @@ index aec5588fae..2df8558a4f 100644 } // namespace mozilla -@@ -934,16 +940,20 @@ bool nsWindow::WidgetTypeSupportsAcceleration() { - if (mWindowType == eWindowType_popup) { - // See Bug 1731125. NVIDIA drivers does not provide transparent - // visual on X11/EGL. -+#ifdef MOZ_X11 - if (GdkIsX11Display() && gfxVars::UseEGL()) { - return false; - } -+#endif - return HasRemoteContent() && mCompositedScreen; - } - // Workaround for Bug 1730822 -+#ifdef MOZ_X11 - if (mWindowType == eWindowType_child && GdkIsX11Display() && - gfxVars::UseEGL()) { - return false; - } -+#endif - - return true; - } -@@ -2479,11 +2489,13 @@ void nsWindow::NativeMove() { - - LOG(("nsWindow::NativeMove [%p] %d %d\n", (void*)this, point.x, point.y)); - -+#ifdef MOZ_X11 - if (GdkIsX11Display() && IsPopup() && - !gtk_widget_get_visible(GTK_WIDGET(mShell))) { - mHiddenPopupPositioned = true; - mPopupPosition = point; - } -+#endif - - if (IsWaylandPopup()) { - GdkRectangle size = DevicePixelsToGdkSizeRoundUp(mBounds.Size()); -@@ -2567,6 +2579,7 @@ void nsWindow::SetSizeMode(nsSizeMode aMode) { +@@ -2510,6 +2513,7 @@ void nsWindow::SetSizeMode(nsSizeMode aMode) { + mSizeState = mSizeMode; } ++#ifdef MOZ_X11 static bool GetWindowManagerName(GdkWindow* gdk_window, nsACString& wmName) { -+#ifdef MOZ_X11 if (!GdkIsX11Display()) { return false; - } -@@ -2633,6 +2646,7 @@ static bool GetWindowManagerName(GdkWindow* gdk_window, nsACString& wmName) { - } - +@@ -2579,10 +2583,12 @@ static bool GetWindowManagerName(GdkWindow* gdk_window, nsACString& wmName) { wmName = reinterpret_cast(prop_return); -+#endif return true; } ++#endif + + #define kDesktopMutterSchema "org.gnome.mutter" + #define kDesktopDynamicWorkspacesKey "dynamic-workspaces" -@@ -2690,6 +2704,7 @@ void nsWindow::GetWorkspaceID(nsAString& workspaceID) { - if (!GdkIsX11Display() || !mShell) { - return; - } +#ifdef MOZ_X11 - // Get the gdk window for this widget. - GdkWindow* gdk_window = gtk_widget_get_window(mShell); - if (!gdk_window) { -@@ -2718,9 +2733,11 @@ void nsWindow::GetWorkspaceID(nsAString& workspaceID) { + static bool WorkspaceManagementDisabled(GdkWindow* gdk_window) { + if (Preferences::GetBool("widget.disable-workspace-management", false)) { + return true; +@@ -2627,8 +2633,10 @@ static bool WorkspaceManagementDisabled(GdkWindow* gdk_window) { + return false; + } ++#endif + + void nsWindow::GetWorkspaceID(nsAString& workspaceID) { ++#ifdef MOZ_X11 + workspaceID.Truncate(); + + if (!GdkIsX11Display() || !mShell) { +@@ -2669,9 +2677,11 @@ void nsWindow::GetWorkspaceID(nsAString& workspaceID) { + LOG(" got workspace ID %d", (int32_t)wm_desktop[0]); workspaceID.AppendInt((int32_t)wm_desktop[0]); g_free(wm_desktop); +#endif @@ -1153,30 +1360,28 @@ index aec5588fae..2df8558a4f 100644 +#ifdef MOZ_X11 nsresult rv = NS_OK; int32_t workspaceID = workspaceIDStr.ToInteger(&rv); - if (NS_FAILED(rv) || !workspaceID || !GdkIsX11Display() || !mShell) { -@@ -2760,6 +2777,7 @@ void nsWindow::MoveToWorkspace(const nsAString& workspaceIDStr) { - SubstructureNotifyMask | SubstructureRedirectMask, &xevent); + +@@ -2716,6 +2726,7 @@ void nsWindow::MoveToWorkspace(const nsAString& workspaceIDStr) { XFlush(xdisplay); + LOG(" moved to workspace"); +#endif } using SetUserTimeFunc = void (*)(GdkWindow*, guint32); -@@ -2800,9 +2818,13 @@ guint32 nsWindow::GetLastUserInputTime() { +@@ -2755,10 +2766,7 @@ guint32 nsWindow::GetLastUserInputTime() { + // WM_DELETE_WINDOW delete events, but not usually mouse motion nor // button and key releases. Therefore use the most recent of // gdk_x11_display_get_user_time and the last time that we have seen. - GdkDisplay* gdkDisplay = gdk_display_get_default(); -+#ifdef MOZ_X11 - guint32 timestamp = GdkIsX11Display(gdkDisplay) - ? gdk_x11_display_get_user_time(gdkDisplay) - : gtk_get_current_event_time(); -+#else +- GdkDisplay* gdkDisplay = gdk_display_get_default(); +- guint32 timestamp = GdkIsX11Display(gdkDisplay) +- ? gdk_x11_display_get_user_time(gdkDisplay) +- : gtk_get_current_event_time(); + guint32 timestamp = gtk_get_current_event_time(); -+#endif if (sLastUserInputTime != GDK_CURRENT_TIME && TimestampIsNewerThan(sLastUserInputTime, timestamp)) { -@@ -2960,6 +2982,7 @@ void nsWindow::UpdateClientOffsetFromFrameExtents() { +@@ -3013,6 +3021,7 @@ void nsWindow::UpdateClientOffsetFromFrameExtents() { return; } @@ -1184,7 +1389,7 @@ index aec5588fae..2df8558a4f 100644 GdkAtom cardinal_atom = gdk_x11_xatom_to_atom(XA_CARDINAL); GdkAtom type_returned; -@@ -2985,6 +3008,7 @@ void nsWindow::UpdateClientOffsetFromFrameExtents() { +@@ -3038,6 +3047,7 @@ void nsWindow::UpdateClientOffsetFromFrameExtents() { mClientOffset = nsIntPoint(left, top); } @@ -1192,23 +1397,19 @@ index aec5588fae..2df8558a4f 100644 // Send a WindowMoved notification. This ensures that BrowserParent // picks up the new client offset and sends it to the child process -@@ -3003,6 +3027,7 @@ LayoutDeviceIntPoint nsWindow::GetClientOffset() { - - gboolean nsWindow::OnPropertyNotifyEvent(GtkWidget* aWidget, - GdkEventProperty* aEvent) { -+#ifdef MOZ_X11 - if (aEvent->atom == gdk_atom_intern("_NET_FRAME_EXTENTS", FALSE)) { - UpdateClientOffsetFromFrameExtents(); +@@ -3063,9 +3073,11 @@ gboolean nsWindow::OnPropertyNotifyEvent(GtkWidget* aWidget, + if (!mGdkWindow) { return FALSE; -@@ -3012,6 +3037,7 @@ gboolean nsWindow::OnPropertyNotifyEvent(GtkWidget* aWidget, + } ++#ifdef MOZ_X11 + if (GetCurrentTimeGetter()->PropertyNotifyHandler(aWidget, aEvent)) { return TRUE; } - +#endif return FALSE; } -@@ -3149,9 +3175,11 @@ void* nsWindow::GetNativeData(uint32_t aDataType) { +@@ -3203,9 +3215,11 @@ void* nsWindow::GetNativeData(uint32_t aDataType) { return GetToplevelWidget(); case NS_NATIVE_WINDOW_WEBRTC_DEVICE_ID: @@ -1220,28 +1421,31 @@ index aec5588fae..2df8558a4f 100644 NS_WARNING( "nsWindow::GetNativeData(): NS_NATIVE_WINDOW_WEBRTC_DEVICE_ID is not " "handled on Wayland!"); -@@ -3171,9 +3199,11 @@ void* nsWindow::GetNativeData(uint32_t aDataType) { - case NS_NATIVE_OPENGL_CONTEXT: +@@ -3226,11 +3240,13 @@ void* nsWindow::GetNativeData(uint32_t aDataType) { return nullptr; case NS_NATIVE_EGL_WINDOW: { + void* eglWindow = nullptr; +#ifdef MOZ_X11 if (GdkIsX11Display()) { - return mGdkWindow ? (void*)GDK_WINDOW_XID(mGdkWindow) : nullptr; + eglWindow = mGdkWindow ? (void*)GDK_WINDOW_XID(mGdkWindow) : nullptr; } +#endif #ifdef MOZ_WAYLAND - if (mContainer) { - return moz_container_wayland_get_egl_window(mContainer, -@@ -3497,7 +3527,7 @@ gboolean nsWindow::OnExposeEvent(cairo_t* cr) { +- else { ++ if (GdkIsWaylandDisplay()) { + eglWindow = moz_container_wayland_get_egl_window( + mContainer, FractionalScaleFactor()); + } +@@ -3520,8 +3536,6 @@ gboolean nsWindow::OnExposeEvent(cairo_t* cr) { + nsIWidgetListener* listener = GetListener(); if (!listener) return FALSE; - LOG(("received expose event [%p] %p 0x%lx (rects follow):\n", this, -- mGdkWindow, GdkIsX11Display() ? gdk_x11_window_get_xid(mGdkWindow) : 0)); -+ mGdkWindow, 0)); +- LOG("received expose event %p 0x%lx (rects follow):\n", mGdkWindow, +- GdkIsX11Display() ? gdk_x11_window_get_xid(mGdkWindow) : 0); LayoutDeviceIntRegion exposeRegion; if (!ExtractExposeRegion(exposeRegion, cr)) { return FALSE; -@@ -4041,6 +4071,7 @@ void nsWindow::OnMotionNotifyEvent(GdkEventMotion* aEvent) { +@@ -4068,6 +4082,7 @@ void nsWindow::OnMotionNotifyEvent(GdkEventMotion* aEvent) { MOZ_ASSERT(gdk_window, "gdk_window_get_toplevel should not return null"); bool canDrag = true; @@ -1249,7 +1453,7 @@ index aec5588fae..2df8558a4f 100644 if (GdkIsX11Display()) { // Workaround for https://bugzilla.gnome.org/show_bug.cgi?id=789054 // To avoid crashes disable double-click on WM without _NET_WM_MOVERESIZE. -@@ -4051,6 +4082,7 @@ void nsWindow::OnMotionNotifyEvent(GdkEventMotion* aEvent) { +@@ -4078,6 +4093,7 @@ void nsWindow::OnMotionNotifyEvent(GdkEventMotion* aEvent) { canDrag = false; } } @@ -1257,14 +1461,23 @@ index aec5588fae..2df8558a4f 100644 if (canDrag) { gdk_window_begin_move_drag(gdk_window, 1, aEvent->x_root, aEvent->y_root, -@@ -4499,16 +4531,20 @@ TimeStamp nsWindow::GetEventTimeStamp(guint32 aEventTime) { +@@ -4519,6 +4535,7 @@ TimeStamp nsWindow::GetEventTimeStamp(guint32 aEventTime) { + + TimeStamp eventTimeStamp; + ++#ifdef MOZ_WAYLAND + if (GdkIsWaylandDisplay()) { + // Wayland compositors use monotonic time to set timestamps. + int64_t timestampTime = g_get_monotonic_time() / 1000; +@@ -4528,16 +4545,21 @@ TimeStamp nsWindow::GetEventTimeStamp(guint32 aEventTime) { int64_t tick = BaseTimeDurationPlatformUtils::TicksFromMilliseconds(timestampTime); eventTimeStamp = TimeStamp::FromSystemTime(tick); - } else { -+ } ++ } ++#endif +#ifdef MOZ_X11 -+ else { ++ if (GdkIsX11Display()) { CurrentX11TimeGetter* getCurrentTime = GetCurrentTimeGetter(); MOZ_ASSERT(getCurrentTime, "Null current time getter despite having a window"); @@ -1279,40 +1492,98 @@ index aec5588fae..2df8558a4f 100644 mozilla::CurrentX11TimeGetter* nsWindow::GetCurrentTimeGetter() { MOZ_ASSERT(mGdkWindow, "Expected mGdkWindow to be set"); if (MOZ_UNLIKELY(!mCurrentTimeGetter)) { -@@ -4516,6 +4552,7 @@ mozilla::CurrentX11TimeGetter* nsWindow::GetCurrentTimeGetter() { +@@ -4545,6 +4567,7 @@ mozilla::CurrentX11TimeGetter* nsWindow::GetCurrentTimeGetter() { } return mCurrentTimeGetter.get(); } +#endif gboolean nsWindow::OnKeyPressEvent(GdkEventKey* aEvent) { - LOG(("OnKeyPressEvent [%p]\n", (void*)this)); -@@ -5100,6 +5137,7 @@ static GdkWindow* CreateGdkWindow(GdkWindow* parent, GtkWidget* widget) { - return window; - } + LOG("OnKeyPressEvent"); +@@ -5210,8 +5233,8 @@ void nsWindow::EnableRenderingToWindow() { + GetShapedState()); + } +- if (GdkIsWaylandDisplay()) { + #ifdef MOZ_WAYLAND ++ if (GdkIsWaylandDisplay()) { + moz_container_wayland_add_initial_draw_callback( + mContainer, [self = RefPtr{this}, this]() -> void { + LOG("moz_container_wayland initial create " +@@ -5219,11 +5242,15 @@ void nsWindow::EnableRenderingToWindow() { + self->ResumeCompositorHiddenWindow(); + self->WaylandStartVsync(); + }); ++ } + #endif +- } else { ++ +#ifdef MOZ_X11 - // Configure GL visual on X11. We add alpha silently - // if we use WebRender to workaround NVIDIA specific Bug 1663273. - bool nsWindow::ConfigureX11GLVisual(bool aUseAlpha) { -@@ -5156,6 +5194,7 @@ bool nsWindow::ConfigureX11GLVisual(bool aUseAlpha) { - - return true; - } ++ if (GdkIsX11Display()) { + ResumeCompositorHiddenWindow(); + WaylandStartVsync(); + } +#endif + } - nsCString nsWindow::GetWindowNodeName() { - nsCString nodeName("Unknown"); -@@ -5740,7 +5779,7 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent, - if (mShell) { - LOG(("\tmShell %p mContainer %p mGdkWindow %p XID 0x%lx\n", mShell, - mContainer, mGdkWindow, -- GdkIsX11Display() ? gdk_x11_window_get_xid(mGdkWindow) : 0)); -+ 0)); - } else if (mContainer) { - LOG(("\tmContainer %p mGdkWindow %p\n", mContainer, mGdkWindow)); - } else if (mGdkWindow) { -@@ -6812,6 +6851,7 @@ void nsWindow::UpdateTitlebarTransparencyBitmap() { + void nsWindow::DisableRenderingToWindow() { +@@ -5236,9 +5263,12 @@ void nsWindow::DisableRenderingToWindow() { + } + } + +-Window nsWindow::GetX11Window() { +- return GdkIsX11Display() && mGdkWindow ? gdk_x11_window_get_xid(mGdkWindow) +- : X11None; ++uintptr_t nsWindow::GetX11Window() { ++#ifdef MOZ_X11 ++ return (uintptr_t)(GdkIsX11Display() && mGdkWindow ? gdk_x11_window_get_xid(mGdkWindow) : X11None); ++#else ++ return (uintptr_t) nullptr; ++#endif + } + + void nsWindow::EnsureGdkWindow() { +@@ -5324,9 +5354,6 @@ void nsWindow::ConfigureGdkWindow() { + if (mHasMappedToplevel) { + EnsureGrabs(); + } +- +- LOG(" finished, new GdkWindow %p XID 0x%lx\n", mGdkWindow, +- GdkIsX11Display() ? gdk_x11_window_get_xid(mGdkWindow) : 0); + } + + void nsWindow::ReleaseGdkWindow() { +@@ -5343,11 +5370,18 @@ void nsWindow::ReleaseGdkWindow() { + mSurfaceProvider.CleanupResources(); + } + ++extern "C" { ++// Make sure mozgtk gets linked ++MOZ_EXPORT void PleaseLinkWithMe(); ++} ++ + nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent, + const LayoutDeviceIntRect& aRect, + nsWidgetInitData* aInitData) { + LOG("nsWindow::Create\n"); + ++ PleaseLinkWithMe(); ++ + // only set the base parent if we're going to be a dialog or a + // toplevel + nsIWidget* baseParent = +@@ -5865,10 +5899,6 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent, + nullptr); + + LOG(" nsWindow type %d %s\n", mWindowType, mIsPIPWindow ? "PIP window" : ""); +- LOG(" mShell %p mContainer %p mGdkWindow %p XID 0x%lx\n", mShell, mContainer, +- mGdkWindow, +- (GdkIsX11Display() && mGdkWindow) ? gdk_x11_window_get_xid(mGdkWindow) +- : 0); + + // Set default application name when it's empty. + if (mGtkWindowAppName.IsEmpty()) { +@@ -6720,6 +6750,7 @@ void nsWindow::UpdateTitlebarTransparencyBitmap() { cairo_surface_destroy(surface); } @@ -1320,7 +1591,7 @@ index aec5588fae..2df8558a4f 100644 if (!mNeedsShow) { Display* xDisplay = GDK_WINDOW_XDISPLAY(mGdkWindow); Window xDrawable = GDK_WINDOW_XID(mGdkWindow); -@@ -6834,6 +6874,7 @@ void nsWindow::UpdateTitlebarTransparencyBitmap() { +@@ -6740,6 +6771,7 @@ void nsWindow::UpdateTitlebarTransparencyBitmap() { XFreePixmap(xDisplay, maskPixmap); } @@ -1328,7 +1599,7 @@ index aec5588fae..2df8558a4f 100644 } void nsWindow::GrabPointer(guint32 aTime) { -@@ -7116,7 +7157,7 @@ static bool IsFullscreenSupported(GtkWidget* aShell) { +@@ -7013,7 +7045,7 @@ static bool IsFullscreenSupported(GtkWidget* aShell) { GdkScreen* screen = gtk_widget_get_screen(aShell); GdkAtom atom = gdk_atom_intern("_NET_WM_STATE_FULLSCREEN", FALSE); return gdk_x11_screen_supports_net_wm_hint(screen, atom); @@ -1337,7 +1608,7 @@ index aec5588fae..2df8558a4f 100644 return true; #endif } -@@ -8396,6 +8437,7 @@ bool nsWindow::GetDragInfo(WidgetMouseEvent* aMouseEvent, GdkWindow** aWindow, +@@ -8297,6 +8329,7 @@ bool nsWindow::GetDragInfo(WidgetMouseEvent* aMouseEvent, GdkWindow** aWindow, return false; } @@ -1345,7 +1616,7 @@ index aec5588fae..2df8558a4f 100644 if (GdkIsX11Display()) { // Workaround for https://bugzilla.gnome.org/show_bug.cgi?id=789054 // To avoid crashes disable double-click on WM without _NET_WM_MOVERESIZE. -@@ -8411,6 +8453,7 @@ bool nsWindow::GetDragInfo(WidgetMouseEvent* aMouseEvent, GdkWindow** aWindow, +@@ -8312,6 +8345,7 @@ bool nsWindow::GetDragInfo(WidgetMouseEvent* aMouseEvent, GdkWindow** aWindow, } } } @@ -1353,30 +1624,11 @@ index aec5588fae..2df8558a4f 100644 // FIXME: It would be nice to have the widget position at the time // of the event, but it's relatively unlikely that the widget has -@@ -9131,6 +9174,7 @@ void nsWindow::GetCompositorWidgetInitData( - mozilla::widget::CompositorWidgetInitData* aInitData) { - nsCString displayName; - -+#ifdef MOZ_X11 - if (GdkIsX11Display() && mXWindow != X11None) { - // Make sure the window XID is propagated to X server, we can fail otherwise - // in GPU process (Bug 1401634). -@@ -9144,6 +9188,10 @@ void nsWindow::GetCompositorWidgetInitData( - *aInitData = mozilla::widget::GtkCompositorWidgetInitData( - (mXWindow != X11None) ? mXWindow : (uintptr_t) nullptr, displayName, - isShaped, GdkIsX11Display(), GetClientSize()); -+#else -+ *aInitData = mozilla::widget::GtkCompositorWidgetInitData( -+ (uintptr_t) nullptr, nsCString(), 0, 0, GetClientSize()); -+#endif - } - - #ifdef MOZ_X11 diff --git a/widget/gtk/nsWindow.h b/widget/gtk/nsWindow.h -index 4b524a0795..2479298799 100644 +index 9baa034477..cfd4a6c178 100644 --- a/widget/gtk/nsWindow.h +++ b/widget/gtk/nsWindow.h -@@ -93,7 +93,9 @@ typedef struct _GdkEventTouchpadPinch GdkEventTouchpadPinch; +@@ -98,7 +98,9 @@ typedef struct _GdkEventTouchpadPinch GdkEventTouchpadPinch; namespace mozilla { class TimeStamp; @@ -1386,7 +1638,7 @@ index 4b524a0795..2479298799 100644 } // namespace mozilla -@@ -274,7 +276,9 @@ class nsWindow final : public nsBaseWidget { +@@ -278,7 +280,9 @@ class nsWindow final : public nsBaseWidget { WidgetEventTime GetWidgetEventTime(guint32 aEventTime); mozilla::TimeStamp GetEventTimeStamp(guint32 aEventTime); @@ -1394,9 +1646,18 @@ index 4b524a0795..2479298799 100644 mozilla::CurrentX11TimeGetter* GetCurrentTimeGetter(); +#endif - virtual void SetInputContext(const InputContext& aContext, - const InputContextAction& aAction) override; -@@ -806,7 +810,9 @@ class nsWindow final : public nsBaseWidget { + void SetInputContext(const InputContext& aContext, + const InputContextAction& aAction) override; +@@ -473,7 +477,7 @@ class nsWindow final : public nsBaseWidget { + void DestroyChildWindows(); + GtkWidget* GetToplevelWidget(); + nsWindow* GetContainerWindow(); +- Window GetX11Window(); ++ uintptr_t GetX11Window(); + bool GetShapedState(); + void EnsureGdkWindow(); + void SetUrgencyHint(GtkWidget* top_window, bool state); +@@ -835,7 +839,9 @@ class nsWindow final : public nsBaseWidget { */ RefPtr mIMContext; @@ -1406,36 +1667,21 @@ index 4b524a0795..2479298799 100644 static GtkWindowDecoration sGtkWindowDecoration; static bool sTransparentMainWindow; -@@ -857,6 +863,7 @@ class nsWindow final : public nsBaseWidget { - void DispatchRestoreEventAccessible(); - #endif - -+mozilla::widget::WindowSurfaceProvider mSurfaceProvider; - #ifdef MOZ_X11 - typedef enum {GTK_WIDGET_COMPOSIDED_DEFAULT = 0, - GTK_WIDGET_COMPOSIDED_DISABLED = 1, -@@ -866,7 +873,6 @@ class nsWindow final : public nsBaseWidget { - Window mXWindow; - Visual* mXVisual; - int mXDepth; -- mozilla::widget::WindowSurfaceProvider mSurfaceProvider; - - bool ConfigureX11GLVisual(bool aUseAlpha); - #endif diff --git a/widget/moz.build b/widget/moz.build -index f5f28d2214..969ab5d003 100644 +index 9cef92614b..8ad6c12c26 100644 --- a/widget/moz.build +++ b/widget/moz.build -@@ -258,7 +258,7 @@ if CONFIG["MOZ_INSTRUMENT_EVENT_LOOP"]: +@@ -271,9 +271,6 @@ if CONFIG["MOZ_INSTRUMENT_EVENT_LOOP"]: EXPORTS.ipc = ["nsGUIEventIPC.h"] -if CONFIG["MOZ_X11"]: -+if CONFIG["MOZ_X11"] or CONFIG["MOZ_WAYLAND"]: - DIRS += ["x11"] - +- DIRS += ["x11"] +- if toolkit in ("cocoa", "windows"): -@@ -305,7 +305,7 @@ if toolkit == "windows": + UNIFIED_SOURCES += [ + "nsBaseClipboard.cpp", +@@ -318,7 +315,7 @@ if toolkit == "windows": "windows/PCompositorWidget.ipdl", "windows/PlatformWidgetTypes.ipdlh", ] @@ -1444,3 +1690,25 @@ index f5f28d2214..969ab5d003 100644 IPDL_SOURCES = [ "gtk/PCompositorWidget.ipdl", "gtk/PlatformWidgetTypes.ipdlh", +diff --git a/widget/x11/moz.build b/widget/x11/moz.build +deleted file mode 100644 +index 81d345c0af..0000000000 +--- a/widget/x11/moz.build ++++ /dev/null +@@ -1,16 +0,0 @@ +-# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +-# vim: set filetype=python: +-# This Source Code Form is subject to the terms of the Mozilla Public +-# License, v. 2.0. If a copy of the MPL was not distributed with this +-# file, You can obtain one at http://mozilla.org/MPL/2.0/. +- +-with Files("**"): +- BUG_COMPONENT = ("Core", "Widget: Gtk") +- +-SOURCES += [ +- "keysym2ucs.c", +-] +- +-FINAL_LIBRARY = "xul" +- +-CFLAGS += CONFIG["MOZ_X11_CFLAGS"] diff --git a/extra/firefox/sources b/extra/firefox/sources index e5fdfb31..ba243de3 100644 --- a/extra/firefox/sources +++ b/extra/firefox/sources @@ -7,4 +7,3 @@ patches/fix-clang-as.patch patches/fix-linux-header.patch patches/no-fribidi.patch patches/no-x11.patch -https://bugzilla.mozilla.org/attachment.cgi?id=9202429 diff --git a/extra/firefox/version b/extra/firefox/version index a5777c60..ee72f07a 100644 --- a/extra/firefox/version +++ b/extra/firefox/version @@ -1 +1 @@ -94.0 1 +97.0.2 1 diff --git a/testing/firefox/README b/testing/firefox/README deleted file mode 100644 index a971327c..00000000 --- a/testing/firefox/README +++ /dev/null @@ -1,126 +0,0 @@ -firefox -________________________________________________________________________________ - -Mozilla Firefox or simply Firefox, is a free and open-source web browser -developed by the Mozilla Foundation and its subsidiary, the Mozilla Corporation. -Firefox uses the Gecko rendering engine to display web pages. [0] - -Upstream: https://www.mozilla.org/firefox - - -[000] Index -________________________________________________________________________________ - -* Installation ........................................................... [001] - * Runtime Dependencies ................................................. [002] - * Privacy Package ...................................................... [003] -* Setup .................................................................. [004] - * Enable VAAPI Acceleration ............................................ [005] -* Usage .................................................................. [006] -* References ............................................................. [007] - - -[001] Installation -________________________________________________________________________________ - -+------------------------------------------------------------------------------+ -| | -| $ kiss b firefox | -| | -+------------------------------------------------------------------------------+ - - ---[002] Runtime Dependencies --------------------------------------------------- - - Firefox needs a few additional things to be fully functional. One is an icon - theme and the other is a font. If you have already installed the fonts and - icon theme of your choosing, this step can be skipped. - - +----------------------------------------------------------------------------+ - | | - | $ kiss b [hicolor-icon-theme|adwaita-icon-theme] | - | $ kiss b ttf-croscore | - | | - +----------------------------------------------------------------------------+ - - ---[003] Privacy Package -------------------------------------------------------- - - Provided is also an optional privacy package which makes Firefox perform zero - unsolicited network requests. More information can be found in the - documentation (@/firefox-privacy) Expect some website breakage when using this - privacy package YMMV. - - +----------------------------------------------------------------------------+ - | | - | $ kiss b firefox-privacy | - | | - +----------------------------------------------------------------------------+ - - -[004] Setup -________________________________________________________________________________ - -As of Firefox 91. There is no need to set special environment variables to -enable Wayland support (in a Wayland only environment like ours). The browser -should start with no further configuration. - - ---[005] Enable VAAPI Acceleration ---------------------------------------------- - -Make sure that the following are set in your about:config page. - -+------------------------------------------------------------------------------+ -| | -| about:config | -| | -| gfx.webrender.all=true | -| media.av1.enabled=false | -| media.ffmpeg.dmabuf-textures.disabled=false | -| media.ffmpeg.vaapi.enabled=true | -| media.ffvpx.enabled=false | -| | -+------------------------------------------------------------------------------+ - -If using AMDGPU, the following kernel option must be enabled. [1] - -+------------------------------------------------------------------------------+ -| | -| .config | -| | -| CONFIG_CHECKPOINT_RESTORE=y | -| | -+------------------------------------------------------------------------------+ - -You may also need to set the following environment variable. - -+------------------------------------------------------------------------------+ -| | -| .profile | -| | -| export MOZ_WAYLAND_DRM_DEVICE=/dev/dri/renderD128 | -| | -+------------------------------------------------------------------------------+ - -To verify that VAAPI is working, launch Firefox with the following argument and -attempt to watch a video. Pay attention for errors in the output. - -+------------------------------------------------------------------------------+ -| | -| $ firefox --MOZ_LOG=PlatformDecoderModule:4 | -| | -+------------------------------------------------------------------------------+ - - -[006] Usage -________________________________________________________________________________ - -Refer to the browser's help output and online documentation for further -information. - - -[007] References -________________________________________________________________________________ - -[0] https://en.wikipedia.org/wiki/Firefox - diff --git a/testing/firefox/build b/testing/firefox/build deleted file mode 100755 index 9e3843c3..00000000 --- a/testing/firefox/build +++ /dev/null @@ -1,122 +0,0 @@ -#!/bin/sh -e - -for p in *.patch; do - patch -p1 < "$p" -done - -# Build autoconf 2.13 for Firefox's sole use. -# See: https://bugzilla.mozilla.org/show_bug.cgi?id=104642 -( - cd autoconf2.13 - - ./configure \ - --prefix="$PWD/../junk" \ - --program-suffix=-2.13 - - make - make install -) - -# Build yasm for Firefox's sole use. Firefox is the only package which needs it -# and upstream is kinda dead. -( - cd yasm - - ./configure \ - --prefix=/ - - make - make DESTDIR="$PWD/../junk" install -) - -# Build zip/unzip for Firefox's sole use. -for f in zip unzip; do ( - cd "$f" - - make \ - CC="$CC $CFLAGS $CXXFLAGS" \ - -f unix/Makefile generic - - make \ - prefix="$PWD/../junk" \ - -f unix/Makefile install -) done - -export PATH="$PWD/junk/bin:$PATH" - -# If using libc++, CXXSTDLIB needs to be set manually. -case $("$CC" -print-file-name=libc++.so) in */*) - export CXXSTDLIB=c++ -esac - -# Instruct the compiler to trim absolute paths in resulting binaries and instead -# change them to relative paths ($PWD/... ./...). -export RUSTFLAGS="$RUSTFLAGS --remap-path-prefix=$PWD=." - -export LDFLAGS="$LDFLAGS -Wl,-rpath=/usr/lib/firefox,--enable-new-dtags" -export RUSTFLAGS="$RUSTFLAGS -Cdebuginfo=0" -export MACH_USE_SYSTEM_PYTHON=1 -export MOZ_DEBUG_FLAGS=-g0 -export MOZBUILD_STATE_PATH=$PWD/state -export MOZ_NOSPAM=1 - -# Firefox fails to link with newer versions of "wayland". -# https://bugs.gentoo.org/811840 -export LDFLAGS="$LDFLAGS -lwayland-client" - -cat > .mozconfig << EOF -ac_add_options --enable-default-toolkit=cairo-gtk3-wayland -ac_add_options --prefix=/usr -ac_add_options --libdir=/usr/lib -ac_add_options --enable-alsa -ac_add_options --enable-strip -ac_add_options --enable-release -ac_add_options --enable-rust-simd -ac_add_options --enable-install-strip -ac_add_options --enable-official-branding -ac_add_options --enable-application=browser -ac_add_options --enable-optimize="${CFLAGS:-} -w" -ac_add_options --with-system-libvpx -ac_add_options --with-system-ffi -ac_add_options --with-system-png -ac_add_options --with-system-jpeg -ac_add_options --with-system-zlib -ac_add_options --with-system-pixman -ac_add_options --without-system-nss -ac_add_options --without-system-nspr -ac_add_options --without-wasm-sandboxed-libraries -ac_add_options --disable-eme -ac_add_options --disable-dbus -ac_add_options --disable-gold -ac_add_options --disable-tests -ac_add_options --disable-vtune -ac_add_options --disable-updater -ac_add_options --disable-jemalloc -ac_add_options --disable-elf-hack -ac_add_options --disable-callgrind -ac_add_options --disable-profiling -ac_add_options --disable-necko-wifi -ac_add_options --disable-crashreporter -ac_add_options --disable-pulseaudio -ac_add_options --disable-accessibility -ac_add_options --disable-debug -ac_add_options --disable-debug-symbols -ac_add_options --disable-parental-controls -ac_add_options --disable-system-extension-dirs -ac_add_options --disable-webrtc -EOF - -./mach build -./mach install - -# Remove a lot of uneeded "stuff". -rm -rf \ - "$1/usr/include" \ - "$1/usr/lib/firefox-devel" \ - "$1/usr/share/idl" \ - "$1/usr/lib/firefox/browser/features/fxmonitor@mozilla.org.xpi" \ - "$1/usr/lib/firefox/browser/features/screenshots@mozilla.org.xpi" \ - "$1/usr/lib/firefox/browser/features/webcompat-reporter@mozilla.org.xpi" \ - "$1/usr/lib/firefox/browser/features/webcompat@mozilla.org.xpi" \ - "$1/usr/lib/firefox/browser/features/doh-rollout@mozilla.org.xpi" - diff --git a/testing/firefox/checksums b/testing/firefox/checksums deleted file mode 100644 index 12535a8a..00000000 --- a/testing/firefox/checksums +++ /dev/null @@ -1,11 +0,0 @@ -7fa3e43f6ec710b2ebba0e99db713a56d13d85f1f23c4a1399bb594fd74864de -f0611136bee505811e9ca11ca7ac188ef5323a8e2ef19cffd3edb3cf08fd791e -3dce6601b495f5b3d45b59f7d2492a340ee7e84b5beca17e48f862502bd5603f -f0e8bb1f9b7eb0b01285495a2699df3a4b766784c1765a8f1aeedf63c0806369 -036d96991646d0449ed0aa952e4fbe21b476ce994abc276e49d30e686708bd37 -42b3c7a29e61905be0e7425b8786870eb1d1c9e0f74c3f0909521b2ac52ac702 -2b5732c15e7eade2a01ad9794de372f25fbb75e4e2f53bce089548bcbbba20d1 -4b06181475f667ae2851540552ade56d5257a03cd21da588e2eb1e538bbc8176 -d2033e9b6d3b2a6b2eb6765eb763e3ce196b76296d9688d59369bf15e671c628 -70d087b61083a9fb831160e53ebff83641aed7712c3a7ac5f731e7e1e8d409b4 -47d30d0b73d3174f8ebbb6d686892fa5435beb3355ddacded70194ef0249ba51 diff --git a/testing/firefox/depends b/testing/firefox/depends deleted file mode 100644 index 377f447e..00000000 --- a/testing/firefox/depends +++ /dev/null @@ -1,32 +0,0 @@ -alsa-lib -atk -bzip2 -cairo -cbindgen make -clang make -expat -ffmpeg -fontconfig -freetype-harfbuzz -gdk-pixbuf -glib -gtk+3 -libdrm -libffi -libjpeg-turbo -libpng -libvpx -llvm make -m4 make -mesa -nasm make -nodejs make -pango -perl make -pixman -pkgconf make -python make -rust make -wayland -wayland-protocols make -zlib diff --git a/testing/firefox/patches/fix-clang-as.patch b/testing/firefox/patches/fix-clang-as.patch deleted file mode 100644 index bb7c2557..00000000 --- a/testing/firefox/patches/fix-clang-as.patch +++ /dev/null @@ -1,48 +0,0 @@ -diff --git a/security/nss/lib/freebl/Makefile b/security/nss/lib/freebl/Makefile -index 0b8c6f4..e9668e1 100644 ---- a/security/nss/lib/freebl/Makefile -+++ b/security/nss/lib/freebl/Makefile -@@ -753,7 +753,6 @@ $(OBJDIR)/$(PROG_PREFIX)intel-gcm-wrap$(OBJ_SUFFIX): CFLAGS += -mssse3 - # .set Htbl, %rdi - # So we can't use Clang's integrated assembler with intel-gcm.s. - ifdef CC_IS_CLANG --$(OBJDIR)/$(PROG_PREFIX)intel-gcm$(OBJ_SUFFIX): CFLAGS += -no-integrated-as - endif - endif - -diff --git a/security/nss/lib/freebl/freebl.gyp b/security/nss/lib/freebl/freebl.gyp -index e7703ba..3ee3435 100644 ---- a/security/nss/lib/freebl/freebl.gyp -+++ b/security/nss/lib/freebl/freebl.gyp -@@ -19,13 +19,10 @@ - 'conditions': [ - [ 'cc_is_clang==1', { - 'cflags': [ -- '-no-integrated-as', - ], - 'cflags_mozilla': [ -- '-no-integrated-as', - ], - 'asflags_mozilla': [ -- '-no-integrated-as', - ], - }], - ], -diff --git a/security/nss/lib/freebl/freebl_base.gypi b/security/nss/lib/freebl/freebl_base.gypi -index afbffac..795bbd8 100644 ---- a/security/nss/lib/freebl/freebl_base.gypi -+++ b/security/nss/lib/freebl/freebl_base.gypi -@@ -74,13 +74,10 @@ - 'conditions': [ - [ 'cc_is_clang==1 and fuzz!=1 and coverage!=1', { - 'cflags': [ -- '-no-integrated-as', - ], - 'cflags_mozilla': [ -- '-no-integrated-as', - ], - 'asflags_mozilla': [ -- '-no-integrated-as', - ], - }], - ], diff --git a/testing/firefox/patches/fix-disable-accessibility.patch b/testing/firefox/patches/fix-disable-accessibility.patch deleted file mode 100644 index a59f643c..00000000 --- a/testing/firefox/patches/fix-disable-accessibility.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/dom/quota/PQuotaRequest.ipdl b/dom/quota/PQuotaRequest.ipdl -index 3e28d1cae1..3f0b2bc61f 100644 ---- a/dom/quota/PQuotaRequest.ipdl -+++ b/dom/quota/PQuotaRequest.ipdl -@@ -3,6 +3,7 @@ - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - - include protocol PQuota; -+include "mozilla/dom/quota/SerializationHelpers.h"; - - using mozilla::dom::quota::FullOriginMetadata - from "mozilla/dom/quota/CommonMetadata.h"; diff --git a/testing/firefox/patches/fix-linux-header.patch b/testing/firefox/patches/fix-linux-header.patch deleted file mode 100644 index 02fc5022..00000000 --- a/testing/firefox/patches/fix-linux-header.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/dom/media/webrtc/transport/third_party/nICEr/src/stun/addrs-netlink.c b/dom/media/webrtc/transport/third_party/nICEr/src/stun/addrs-netlink.c -index 73e85c6..9eca548 100644 ---- a/dom/media/webrtc/transport/third_party/nICEr/src/stun/addrs-netlink.c -+++ b/dom/media/webrtc/transport/third_party/nICEr/src/stun/addrs-netlink.c -@@ -31,6 +31,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - #if defined(LINUX) -+#include - #include "addrs-netlink.h" - #include - #include diff --git a/testing/firefox/patches/no-fribidi.patch b/testing/firefox/patches/no-fribidi.patch deleted file mode 100644 index e8d1fc44..00000000 --- a/testing/firefox/patches/no-fribidi.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/config/system-headers.mozbuild b/config/system-headers.mozbuild -index 6e017df..7659b8e 100644 ---- a/config/system-headers.mozbuild -+++ b/config/system-headers.mozbuild -@@ -267,7 +267,6 @@ system_headers = [ - 'freetype/t1tables.h', - 'freetype/ttnameid.h', - 'freetype/tttables.h', -- 'fribidi/fribidi.h', - 'FSp_fopen.h', - 'fstream', - 'fstream.h', diff --git a/testing/firefox/patches/no-x11.patch b/testing/firefox/patches/no-x11.patch deleted file mode 100644 index 50da1b53..00000000 --- a/testing/firefox/patches/no-x11.patch +++ /dev/null @@ -1,1352 +0,0 @@ -diff --git a/gfx/angle/checkout/include/EGL/eglplatform.h b/gfx/angle/checkout/include/EGL/eglplatform.h -index 9ebaf00a9b..59b65acd7f 100644 ---- a/gfx/angle/checkout/include/EGL/eglplatform.h -+++ b/gfx/angle/checkout/include/EGL/eglplatform.h -@@ -109,7 +109,7 @@ typedef intptr_t EGLNativeDisplayType; - typedef intptr_t EGLNativePixmapType; - typedef intptr_t EGLNativeWindowType; - --#elif defined(__unix__) && defined(EGL_NO_X11) -+#elif defined(__unix__) - - typedef void *EGLNativeDisplayType; - typedef khronos_uintptr_t EGLNativePixmapType; -diff --git a/gfx/cairo/cairo/src/cairo-features.h b/gfx/cairo/cairo/src/cairo-features.h -index cfed9d9a2f..fd1eb869d3 100644 ---- a/gfx/cairo/cairo/src/cairo-features.h -+++ b/gfx/cairo/cairo/src/cairo-features.h -@@ -55,8 +55,8 @@ - #define CAIRO_HAS_PDF_SURFACE 1 - #endif - --#ifdef MOZ_X11 - #define CAIRO_HAS_PS_SURFACE 1 -+#ifdef MOZ_X11 - #define CAIRO_HAS_XLIB_XRENDER_SURFACE 0 - #define CAIRO_HAS_XLIB_SURFACE 1 - #endif -diff --git a/gfx/gl/GLContextProvider.h b/gfx/gl/GLContextProvider.h -index 12d1a497b9..d30b01c144 100644 ---- a/gfx/gl/GLContextProvider.h -+++ b/gfx/gl/GLContextProvider.h -@@ -55,17 +55,18 @@ namespace gl { - # define GL_CONTEXT_PROVIDER_NAME GLContextProviderX11 - # include "GLContextProviderImpl.h" - # undef GL_CONTEXT_PROVIDER_NAME --# if defined(MOZ_WAYLAND) --# define GL_CONTEXT_PROVIDER_NAME GLContextProviderWayland --# include "GLContextProviderImpl.h" --# undef GL_CONTEXT_PROVIDER_NAME --# define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderWayland --# endif - # ifndef GL_CONTEXT_PROVIDER_DEFAULT - # define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderX11 - # endif - #endif - -+#if defined(MOZ_WAYLAND) -+# define GL_CONTEXT_PROVIDER_NAME GLContextProviderWayland -+# include "GLContextProviderImpl.h" -+# undef GL_CONTEXT_PROVIDER_NAME -+# define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderWayland -+#endif -+ - #ifndef GL_CONTEXT_PROVIDER_DEFAULT - # define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderEGL - #endif -diff --git a/gfx/gl/GLContextProviderWayland.cpp b/gfx/gl/GLContextProviderWayland.cpp -index 3f1f926cd9..cd49dc5f17 100644 ---- a/gfx/gl/GLContextProviderWayland.cpp -+++ b/gfx/gl/GLContextProviderWayland.cpp -@@ -14,7 +14,6 @@ namespace mozilla::gl { - using namespace mozilla::gfx; - using namespace mozilla::widget; - --static class GLContextProviderX11 sGLContextProviderX11; - static class GLContextProviderEGL sGLContextProviderEGL; - - // Note that if there is no GTK display, `GdkIsX11Display` and -@@ -30,41 +29,24 @@ static class GLContextProviderEGL sGLContextProviderEGL; - already_AddRefed GLContextProviderWayland::CreateForCompositorWidget( - CompositorWidget* aCompositorWidget, bool aHardwareWebRender, - bool aForceAccelerated) { -- if (GdkIsWaylandDisplay()) { - return sGLContextProviderEGL.CreateForCompositorWidget( - aCompositorWidget, aHardwareWebRender, aForceAccelerated); -- } else { -- return sGLContextProviderX11.CreateForCompositorWidget( -- aCompositorWidget, aHardwareWebRender, aForceAccelerated); -- } - } - - /*static*/ - already_AddRefed GLContextProviderWayland::CreateHeadless( - const GLContextCreateDesc& desc, nsACString* const out_failureId) { -- if (GdkIsWaylandDisplay()) { - return sGLContextProviderEGL.CreateHeadless(desc, out_failureId); -- } else { -- return sGLContextProviderX11.CreateHeadless(desc, out_failureId); -- } - } - - /*static*/ - GLContext* GLContextProviderWayland::GetGlobalContext() { -- if (GdkIsWaylandDisplay()) { - return sGLContextProviderEGL.GetGlobalContext(); -- } else { -- return sGLContextProviderX11.GetGlobalContext(); -- } - } - - /*static*/ - void GLContextProviderWayland::Shutdown() { -- if (GdkIsWaylandDisplay()) { - sGLContextProviderEGL.Shutdown(); -- } else { -- sGLContextProviderX11.Shutdown(); -- } - } - - } // namespace mozilla::gl -diff --git a/gfx/gl/moz.build b/gfx/gl/moz.build -index 7ac6b0753a..a817a6fb08 100644 ---- a/gfx/gl/moz.build -+++ b/gfx/gl/moz.build -@@ -13,7 +13,7 @@ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa": - elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "uikit": - gl_provider = "EAGL" - elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk": -- if CONFIG["MOZ_EGL_XRENDER_COMPOSITE"]: -+ if CONFIG["MOZ_EGL_XRENDER_COMPOSITE"] or CONFIG["MOZ_WAYLAND"]: - gl_provider = "EGL" - else: - gl_provider = "GLX" -diff --git a/gfx/thebes/gfxPlatformGtk.cpp b/gfx/thebes/gfxPlatformGtk.cpp -index 1b46a2aab8..238680c2ac 100644 ---- a/gfx/thebes/gfxPlatformGtk.cpp -+++ b/gfx/thebes/gfxPlatformGtk.cpp -@@ -31,7 +31,6 @@ - #include "mozilla/FontPropertyTypes.h" - #include "mozilla/gfx/2D.h" - #include "mozilla/gfx/Logging.h" --#include "mozilla/gfx/XlibDisplay.h" - #include "mozilla/Monitor.h" - #include "mozilla/Preferences.h" - #include "mozilla/StaticPrefs_gfx.h" -@@ -65,6 +64,7 @@ - # include "mozilla/widget/nsWaylandDisplay.h" - # include "mozilla/widget/DMABufLibWrapper.h" - # include "mozilla/StaticPrefs_widget.h" -+# include "mozilla/WidgetUtilsGtk.h" - #endif - - #define GDK_PIXMAP_SIZE_MAX 32767 -@@ -100,7 +100,7 @@ gfxPlatformGtk::gfxPlatformGtk() { - } - - mMaxGenericSubstitutions = UNINITIALIZED_VALUE; -- mIsX11Display = gfxPlatform::IsHeadless() ? false : GdkIsX11Display(); -+ mIsX11Display = false; - if (XRE_IsParentProcess()) { - InitX11EGLConfig(); - if (IsWaylandDisplay() || gfxConfig::IsEnabled(Feature::X11_EGL)) { -@@ -127,7 +127,6 @@ gfxPlatformGtk::gfxPlatformGtk() { - - // Bug 1714483: Force disable FXAA Antialiasing on NV drivers. This is a - // temporary workaround for a driver bug. -- PR_SetEnv("__GL_ALLOW_FXAA_USAGE=0"); - } - - gfxPlatformGtk::~gfxPlatformGtk() { -diff --git a/gfx/webrender_bindings/RenderCompositorOGLSWGL.cpp b/gfx/webrender_bindings/RenderCompositorOGLSWGL.cpp -index cf3fc3c2ca..7cb5b573c1 100644 ---- a/gfx/webrender_bindings/RenderCompositorOGLSWGL.cpp -+++ b/gfx/webrender_bindings/RenderCompositorOGLSWGL.cpp -@@ -27,7 +27,7 @@ - #ifdef MOZ_WIDGET_GTK - # include "mozilla/widget/GtkCompositorWidget.h" - # include --# include -+# include - #endif - - namespace mozilla { -diff --git a/toolkit/components/remote/moz.build b/toolkit/components/remote/moz.build -index c1853a9f4d..cb6b7f0a9c 100644 ---- a/toolkit/components/remote/moz.build -+++ b/toolkit/components/remote/moz.build -@@ -26,12 +26,6 @@ if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk": - "nsUnixRemoteServer.h", - "RemoteUtils.h", - ] -- else: -- SOURCES += [ -- "nsGTKRemoteServer.cpp", -- "nsXRemoteClient.cpp", -- "nsXRemoteServer.cpp", -- ] - CXXFLAGS += CONFIG["TK_CFLAGS"] - - if CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows": -diff --git a/toolkit/components/remote/nsRemoteService.cpp b/toolkit/components/remote/nsRemoteService.cpp -index b2499d8191..0a1c729570 100644 ---- a/toolkit/components/remote/nsRemoteService.cpp -+++ b/toolkit/components/remote/nsRemoteService.cpp -@@ -12,13 +12,18 @@ - - #ifdef MOZ_WIDGET_GTK - # include "mozilla/WidgetUtilsGtk.h" --# include "nsGTKRemoteServer.h" - # ifdef MOZ_ENABLE_DBUS - # include "nsDBusRemoteServer.h" - # include "nsDBusRemoteClient.h" --# else -+# endif -+# ifdef MOZ_X11 -+# include "nsGTKRemoteServer.h" - # include "nsXRemoteClient.h" - # endif -+# ifdef MOZ_WAYLAND -+# include -+# include "nsRemoteClient.h" -+# endif - #elif defined(XP_WIN) - # include "nsWinRemoteServer.h" - # include "nsWinRemoteClient.h" -@@ -98,11 +103,12 @@ RemoteResult nsRemoteService::StartClient(const char* aDesktopStartupID) { - return REMOTE_NOT_FOUND; - } - -+ return REMOTE_NOT_FOUND; - UniquePtr client; - #ifdef MOZ_WIDGET_GTK - # if defined(MOZ_ENABLE_DBUS) - client = MakeUnique(); --# else -+# elif defined(MOZ_X11) - client = MakeUnique(); - # endif - #elif defined(XP_WIN) -@@ -143,10 +149,11 @@ void nsRemoteService::StartupServer() { - return; - } - -+ return; - #ifdef MOZ_WIDGET_GTK - # if defined(MOZ_ENABLE_DBUS) - mRemoteServer = MakeUnique(); --# else -+# elif defined(MOZ_X11) - mRemoteServer = MakeUnique(); - # endif - #elif defined(XP_WIN) -diff --git a/toolkit/moz.configure b/toolkit/moz.configure -index a78a32bdc0..d6bed82e1b 100644 ---- a/toolkit/moz.configure -+++ b/toolkit/moz.configure -@@ -1170,35 +1170,6 @@ set_define("MOZ_RAW", depends_if("--enable-raw")(lambda _: True)) - - # X11 - # ============================================================== --set_config("MOZ_X11", True, when=toolkit_gtk) --set_define("MOZ_X11", True, when=toolkit_gtk) -- -- --@depends(webrtc, when=toolkit_gtk) --def x11_libs(webrtc): -- libs = [ -- "x11", -- "xcb", -- "xcb-shm", -- "x11-xcb", -- "xext", -- "xrandr >= 1.4.0", -- ] -- if webrtc: -- # third_party/libwebrtc/webrtc/webrtc_gn/moz.build adds those -- # manually, ensure they're available. -- libs += [ -- "xcomposite", -- "xcursor", -- "xdamage", -- "xfixes", -- "xi", -- ] -- return libs -- -- --pkg_check_modules("MOZ_X11", x11_libs, when=toolkit_gtk) --pkg_check_modules("MOZ_X11_SM", ["ice", "sm"], cflags_only=True, when=toolkit_gtk) - - - # ASan Reporter Addon -diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp -index 60ea6966cc..01ea1a8774 100644 ---- a/toolkit/xre/nsAppRunner.cpp -+++ b/toolkit/xre/nsAppRunner.cpp -@@ -346,7 +346,6 @@ void XRE_LibFuzzerSetDriver(LibFuzzerDriver aDriver) { - #endif // FUZZING - - // Undo X11/X.h's definition of None --#undef None - - namespace mozilla { - int (*RunGTest)(int*, char**) = 0; -diff --git a/toolkit/xre/nsGDKErrorHandler.cpp b/toolkit/xre/nsGDKErrorHandler.cpp -index 421abdf12f..7727f0f3e7 100644 ---- a/toolkit/xre/nsGDKErrorHandler.cpp -+++ b/toolkit/xre/nsGDKErrorHandler.cpp -@@ -6,14 +6,13 @@ - #include "nsGDKErrorHandler.h" - - #include --#include -+#include - #include - #include - #include - - #include "nsDebug.h" - #include "nsString.h" --#include "nsX11ErrorHandler.h" - - #include "prenv.h" - -@@ -26,6 +25,7 @@ - */ - static void GdkErrorHandler(const gchar* log_domain, GLogLevelFlags log_level, - const gchar* message, gpointer user_data) { -+#ifdef MOZ_X11 - if (strstr(message, "X Window System error")) { - XErrorEvent event; - nsDependentCString buffer(message); -@@ -93,9 +93,12 @@ static void GdkErrorHandler(const gchar* log_domain, GLogLevelFlags log_level, - - X11Error(event.display, &event); - } else { -+#endif - g_log_default_handler(log_domain, log_level, message, user_data); - MOZ_CRASH_UNSAFE(message); -+#ifdef MOZ_X11 - } -+#endif - } - - void InstallGdkErrorHandler() { -@@ -103,7 +106,9 @@ void InstallGdkErrorHandler() { - (GLogLevelFlags)(G_LOG_LEVEL_ERROR | G_LOG_FLAG_FATAL | - G_LOG_FLAG_RECURSION), - GdkErrorHandler, nullptr); -+#ifdef MOZ_X11 - if (PR_GetEnv("MOZ_X_SYNC")) { - XSynchronize(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), X11True); - } -+#endif - } -diff --git a/widget/CompositorWidget.h b/widget/CompositorWidget.h -index 20eb3634f3..10fb94a99f 100644 ---- a/widget/CompositorWidget.h -+++ b/widget/CompositorWidget.h -@@ -62,7 +62,7 @@ class CompositorWidgetDelegate { - }; - - // Platforms that support out-of-process widgets. --#if defined(XP_WIN) || defined(MOZ_X11) -+#if defined(XP_WIN) || defined(MOZ_X11) || defined(MOZ_WAYLAND) - // CompositorWidgetParent should implement CompositorWidget and - // PCompositorWidgetParent. - class CompositorWidgetParent; -diff --git a/widget/gtk/GtkCompositorWidget.cpp b/widget/gtk/GtkCompositorWidget.cpp -index 89a8248bc0..38b0a14028 100644 ---- a/widget/gtk/GtkCompositorWidget.cpp -+++ b/widget/gtk/GtkCompositorWidget.cpp -@@ -49,9 +49,9 @@ GtkCompositorWidget::GtkCompositorWidget( - auto size = mClientSize.Lock(); - *size = aInitData.InitialClientSize(); - -- LOG("GtkCompositorWidget::GtkCompositorWidget() [%p] mXWindow %p " -+ LOG("GtkCompositorWidget::GtkCompositorWidget() [%p] " - "mIsRenderingSuspended %d\n", -- (void*)mWidget.get(), (void*)mXWindow, !!mIsRenderingSuspended); -+ (void*)mWidget.get(), !!mIsRenderingSuspended); - } - - GtkCompositorWidget::~GtkCompositorWidget() { -diff --git a/widget/gtk/MozContainer.cpp b/widget/gtk/MozContainer.cpp -index 95832dc03d..8a92ec88dc 100644 ---- a/widget/gtk/MozContainer.cpp -+++ b/widget/gtk/MozContainer.cpp -@@ -9,7 +9,7 @@ - - #include - #include --#include -+#include - #include - #include "mozilla/WidgetUtilsGtk.h" - -diff --git a/widget/gtk/components.conf b/widget/gtk/components.conf -index 38c07bd812..a125d8d275 100644 ---- a/widget/gtk/components.conf -+++ b/widget/gtk/components.conf -@@ -78,7 +78,7 @@ Classes = [ - }, - ] - --if defined('MOZ_X11'): -+if defined('MOZ_X11') or defined('MOZ_WAYLAND'): - Classes += [ - { - 'js_name': 'clipboard', -diff --git a/widget/gtk/moz.build b/widget/gtk/moz.build -index 291e3a78c8..7955b84d0c 100644 ---- a/widget/gtk/moz.build -+++ b/widget/gtk/moz.build -@@ -101,22 +101,26 @@ if CONFIG["MOZ_WAYLAND"]: - - if CONFIG["MOZ_X11"]: - UNIFIED_SOURCES += [ -- "CompositorWidgetChild.cpp", -- "CompositorWidgetParent.cpp", -- "InProcessGtkCompositorWidget.cpp", - "nsClipboardX11.cpp", - "nsShmImage.cpp", -- "nsUserIdleServiceGTK.cpp", - "WindowSurfaceX11.cpp", - "WindowSurfaceX11Image.cpp", - "WindowSurfaceX11SHM.cpp", - ] -- EXPORTS.mozilla.widget += [ -- "CompositorWidgetChild.h", -- "CompositorWidgetParent.h", -- "GtkCompositorWidget.h", -- "InProcessGtkCompositorWidget.h", -- ] -+ -+UNIFIED_SOURCES += [ -+ "CompositorWidgetChild.cpp", -+ "CompositorWidgetParent.cpp", -+ "InProcessGtkCompositorWidget.cpp", -+ "nsUserIdleServiceGTK.cpp", -+] -+ -+EXPORTS.mozilla.widget += [ -+ "CompositorWidgetChild.h", -+ "CompositorWidgetParent.h", -+ "GtkCompositorWidget.h", -+ "InProcessGtkCompositorWidget.h", -+] - - if CONFIG["NS_PRINTING"]: - UNIFIED_SOURCES += [ -@@ -145,7 +149,7 @@ LOCAL_INCLUDES += [ - "/widget/headless", - ] - --if CONFIG["MOZ_X11"]: -+if CONFIG["MOZ_X11"] or CONFIG["MOZ_WAYLAND"]: - LOCAL_INCLUDES += [ - "/widget/x11", - ] -diff --git a/widget/gtk/mozgtk/mozgtk.c b/widget/gtk/mozgtk/mozgtk.c -index 677f9b3561..7120c83352 100644 ---- a/widget/gtk/mozgtk/mozgtk.c -+++ b/widget/gtk/mozgtk/mozgtk.c -@@ -6,7 +6,6 @@ - - #include "mozilla/Types.h" - --#include - // Bug 1271100 - // We need to trick system Cairo into not using the XShm extension due to - // a race condition in it that results in frequent BadAccess errors. Cairo -@@ -18,4 +17,3 @@ - // This is also used to force libxul to depend on the mozgtk library. If we - // ever can remove this workaround for system Cairo, we'll need something - // to replace it for that purpose. --MOZ_EXPORT Bool XShmQueryExtension(Display* aDisplay) { return False; } -diff --git a/widget/gtk/nsClipboard.cpp b/widget/gtk/nsClipboard.cpp -index ed15e549de..77fe18509c 100644 ---- a/widget/gtk/nsClipboard.cpp -+++ b/widget/gtk/nsClipboard.cpp -@@ -9,7 +9,6 @@ - - #include "nsArrayUtils.h" - #include "nsClipboard.h" --#include "nsClipboardX11.h" - #if defined(MOZ_WAYLAND) - # include "nsClipboardWayland.h" - # include "nsClipboardWaylandAsync.h" -@@ -37,7 +36,6 @@ - #include "imgIContainer.h" - - #include --#include - - #include "mozilla/Encoding.h" - -@@ -106,16 +104,12 @@ nsClipboard::~nsClipboard() { - NS_IMPL_ISUPPORTS(nsClipboard, nsIClipboard, nsIObserver) - - nsresult nsClipboard::Init(void) { -- if (widget::GdkIsX11Display()) { -- mContext = new nsRetrievalContextX11(); --#if defined(MOZ_WAYLAND) -- } else if (widget::GdkIsWaylandDisplay()) { -+ if (widget::GdkIsWaylandDisplay()) { - if (StaticPrefs::widget_wayland_async_clipboard_enabled_AtStartup()) { - mContext = new nsRetrievalContextWaylandAsync(); - } else { - mContext = new nsRetrievalContextWayland(); - } --#endif - } else { - NS_WARNING("Missing nsRetrievalContext for nsClipboard!"); - return NS_OK; -@@ -353,11 +347,6 @@ nsClipboard::GetData(nsITransferable* aTransferable, int32_t aWhichClipboard) { - - // Filter out MIME types on X11 to prevent unwanted conversions, - // see Bug 1611407 -- if (widget::GdkIsX11Display()) { -- if (!FilterImportedFlavors(aWhichClipboard, flavors)) { -- return NS_OK; -- } -- } - - for (uint32_t i = 0; i < flavors.Length(); i++) { - nsCString& flavorStr = flavors[i]; -diff --git a/widget/gtk/nsDragService.cpp b/widget/gtk/nsDragService.cpp -index fcd4236261..890c67d860 100644 ---- a/widget/gtk/nsDragService.cpp -+++ b/widget/gtk/nsDragService.cpp -@@ -23,7 +23,7 @@ - #include "prthread.h" - #include - #include --#include -+#include - #include "nsCRT.h" - #include "mozilla/BasicEvents.h" - #include "mozilla/Services.h" -@@ -34,7 +34,6 @@ - #include "mozilla/WidgetUtilsGtk.h" - #include "GRefPtr.h" - --#include "gfxXlibSurface.h" - #include "gfxContext.h" - #include "nsImageToPixbuf.h" - #include "nsPresContext.h" -diff --git a/widget/gtk/nsGtkKeyUtils.cpp b/widget/gtk/nsGtkKeyUtils.cpp -index f4c7030a37..ae5d75671e 100644 ---- a/widget/gtk/nsGtkKeyUtils.cpp -+++ b/widget/gtk/nsGtkKeyUtils.cpp -@@ -12,10 +12,9 @@ - #include - #include - #include --#include -+#include - #include - #include --#include - #include "X11UndefineNone.h" - #include "IMContextWrapper.h" - #include "WidgetUtils.h" -@@ -51,7 +50,7 @@ LazyLogModule gKeymapWrapperLog("KeymapWrapperWidgets"); - - KeymapWrapper* KeymapWrapper::sInstance = nullptr; - guint KeymapWrapper::sLastRepeatableHardwareKeyCode = 0; --Time KeymapWrapper::sLastRepeatableKeyTime = 0; -+GTime KeymapWrapper::sLastRepeatableKeyTime = 0; - KeymapWrapper::RepeatState KeymapWrapper::sRepeatState = - KeymapWrapper::NOT_PRESSED; - -@@ -346,9 +345,6 @@ KeymapWrapper::KeymapWrapper() - - g_object_ref(mGdkKeymap); - -- if (GdkIsX11Display()) { -- InitXKBExtension(); -- } - - Init(); - } -@@ -365,16 +361,10 @@ void KeymapWrapper::Init() { - mModifierKeys.Clear(); - memset(mModifierMasks, 0, sizeof(mModifierMasks)); - -- if (GdkIsX11Display()) { -- InitBySystemSettingsX11(); -- } - #ifdef MOZ_WAYLAND -- else { - InitBySystemSettingsWayland(); -- } - #endif - -- gdk_window_add_filter(nullptr, FilterEvents, this); - - MOZ_LOG(gKeymapWrapperLog, LogLevel::Info, - ("%p Init, CapsLock=0x%X, NumLock=0x%X, " -@@ -387,6 +377,7 @@ void KeymapWrapper::Init() { - GetModifierMask(SUPER), GetModifierMask(HYPER))); - } - -+#ifdef MOZ_X11 - void KeymapWrapper::InitXKBExtension() { - PodZero(&mKeyboardState); - -@@ -619,6 +610,7 @@ void KeymapWrapper::InitBySystemSettingsX11() { - XFreeModifiermap(xmodmap); - XFree(xkeymap); - } -+#endif - - #ifdef MOZ_WAYLAND - void KeymapWrapper::SetModifierMask(xkb_keymap* aKeymap, -@@ -776,7 +768,6 @@ void KeymapWrapper::InitBySystemSettingsWayland() { - #endif - - KeymapWrapper::~KeymapWrapper() { -- gdk_window_remove_filter(nullptr, FilterEvents, this); - if (mOnKeysChangedSignalHandle) { - g_signal_handler_disconnect(mGdkKeymap, mOnKeysChangedSignalHandle); - } -@@ -787,6 +778,7 @@ KeymapWrapper::~KeymapWrapper() { - MOZ_LOG(gKeymapWrapperLog, LogLevel::Info, ("%p Destructor", this)); - } - -+#ifdef MOZ_X11 - /* static */ - GdkFilterReturn KeymapWrapper::FilterEvents(GdkXEvent* aXEvent, - GdkEvent* aGdkEvent, -@@ -900,6 +892,7 @@ GdkFilterReturn KeymapWrapper::FilterEvents(GdkXEvent* aXEvent, - - return GDK_FILTER_CONTINUE; - } -+#endif - - static void ResetBidiKeyboard() { - // Reset the bidi keyboard settings for the new GdkKeymap -@@ -1760,6 +1753,7 @@ void KeymapWrapper::InitKeyEvent(WidgetKeyboardEvent& aKeyEvent, - // state. It means if there're some pending modifier key press or - // key release events, the result isn't what we want. - guint modifierState = aGdkKeyEvent->state; -+#ifdef MOZ_X11 - GdkDisplay* gdkDisplay = gdk_display_get_default(); - if (aGdkKeyEvent->is_modifier && GdkIsX11Display(gdkDisplay)) { - Display* display = gdk_x11_display_get_xdisplay(gdkDisplay); -@@ -1777,6 +1771,7 @@ void KeymapWrapper::InitKeyEvent(WidgetKeyboardEvent& aKeyEvent, - } - } - } -+#endif - InitInputEvent(aKeyEvent, modifierState); - - switch (aGdkKeyEvent->keyval) { -@@ -2023,6 +2018,7 @@ bool KeymapWrapper::IsLatinGroup(guint8 aGroup) { - return result; - } - -+#ifdef MOZ_X11 - bool KeymapWrapper::IsAutoRepeatableKey(guint aHardwareKeyCode) { - uint8_t indexOfArray = aHardwareKeyCode / 8; - MOZ_ASSERT(indexOfArray < ArrayLength(mKeyboardState.auto_repeats), -@@ -2030,6 +2026,7 @@ bool KeymapWrapper::IsAutoRepeatableKey(guint aHardwareKeyCode) { - char bitMask = 1 << (aHardwareKeyCode % 8); - return (mKeyboardState.auto_repeats[indexOfArray] & bitMask) != 0; - } -+#endif - - /* static */ - bool KeymapWrapper::IsBasicLatinLetterOrNumeral(uint32_t aCharCode) { -diff --git a/widget/gtk/nsGtkKeyUtils.h b/widget/gtk/nsGtkKeyUtils.h -index 07d60c27a6..58b30cc959 100644 ---- a/widget/gtk/nsGtkKeyUtils.h -+++ b/widget/gtk/nsGtkKeyUtils.h -@@ -13,7 +13,6 @@ - #include "nsTArray.h" - - #include --#include - #ifdef MOZ_WAYLAND - # include - # include -@@ -315,7 +314,6 @@ class KeymapWrapper { - * See a call of XkbSelectEventDetails() with XkbControlsNotify in - * InitXKBExtension(). - */ -- XKeyboardState mKeyboardState; - - /** - * Pointer of the singleton instance. -@@ -326,7 +324,7 @@ class KeymapWrapper { - * Auto key repeat management. - */ - static guint sLastRepeatableHardwareKeyCode; -- static Time sLastRepeatableKeyTime; -+ static GTime sLastRepeatableKeyTime; - enum RepeatState { NOT_PRESSED, FIRST_PRESS, REPEATING }; - static RepeatState sRepeatState; - -diff --git a/widget/gtk/nsPrintDialogGTK.cpp b/widget/gtk/nsPrintDialogGTK.cpp -index 0050af3af3..ae7d83f391 100644 ---- a/widget/gtk/nsPrintDialogGTK.cpp -+++ b/widget/gtk/nsPrintDialogGTK.cpp -@@ -26,7 +26,7 @@ - #include "nsIObserverService.h" - - // for gdk_x11_window_get_xid --#include -+#include - #include - #include - #include -@@ -525,6 +525,7 @@ static void wayland_window_handle_exported(GdkWindow* window, - static gboolean window_export_handle(GtkWindow* window, - GtkWindowHandleExported callback, - gpointer user_data) { -+#ifdef MOZ_X11 - if (GdkIsX11Display()) { - GdkWindow* gdk_window = gtk_widget_get_window(GTK_WIDGET(window)); - char* handle_str; -@@ -535,8 +536,9 @@ static gboolean window_export_handle(GtkWindow* window, - g_free(handle_str); - return true; - } -+#endif - #ifdef MOZ_WAYLAND -- else if (GdkIsWaylandDisplay()) { -+ if (GdkIsWaylandDisplay()) { - GdkWindow* gdk_window = gtk_widget_get_window(GTK_WIDGET(window)); - WaylandWindowHandleExportedData* data; - -diff --git a/widget/gtk/nsUserIdleServiceGTK.cpp b/widget/gtk/nsUserIdleServiceGTK.cpp -index 884d52a6ca..b6dfc813fa 100644 ---- a/widget/gtk/nsUserIdleServiceGTK.cpp -+++ b/widget/gtk/nsUserIdleServiceGTK.cpp -@@ -17,6 +17,7 @@ using mozilla::LogLevel; - - static mozilla::LazyLogModule sIdleLog("nsIUserIdleService"); - -+#ifdef MOZ_X11 - typedef bool (*_XScreenSaverQueryExtension_fn)(Display* dpy, int* event_base, - int* error_base); - -@@ -25,12 +26,14 @@ typedef XScreenSaverInfo* (*_XScreenSaverAllocInfo_fn)(void); - typedef void (*_XScreenSaverQueryInfo_fn)(Display* dpy, Drawable drw, - XScreenSaverInfo* info); - --static bool sInitialized = false; - static _XScreenSaverQueryExtension_fn _XSSQueryExtension = nullptr; - static _XScreenSaverAllocInfo_fn _XSSAllocInfo = nullptr; - static _XScreenSaverQueryInfo_fn _XSSQueryInfo = nullptr; -+#endif -+static bool sInitialized = false; - - static void Initialize() { -+#ifdef MOZ_X11 - if (!mozilla::widget::GdkIsX11Display()) { - return; - } -@@ -57,16 +60,15 @@ static void Initialize() { - MOZ_LOG(sIdleLog, LogLevel::Warning, ("Failed to get XSSAllocInfo!\n")); - if (!_XSSQueryInfo) - MOZ_LOG(sIdleLog, LogLevel::Warning, ("Failed to get XSSQueryInfo!\n")); -- -+#endif - sInitialized = true; - } - --nsUserIdleServiceGTK::nsUserIdleServiceGTK() : mXssInfo(nullptr) { -+nsUserIdleServiceGTK::nsUserIdleServiceGTK() { - Initialize(); - } - - nsUserIdleServiceGTK::~nsUserIdleServiceGTK() { -- if (mXssInfo) XFree(mXssInfo); - - // It is not safe to unload libXScrnSaver until each display is closed because - // the library registers callbacks through XESetCloseDisplay (Bug 397607). -@@ -85,6 +87,7 @@ bool nsUserIdleServiceGTK::PollIdleTime(uint32_t* aIdleTime) { - return false; - } - -+#ifdef MOZ_X11 - // Ask xscreensaver about idle time: - *aIdleTime = 0; - -@@ -107,6 +110,7 @@ bool nsUserIdleServiceGTK::PollIdleTime(uint32_t* aIdleTime) { - *aIdleTime = mXssInfo->idle; - return true; - } -+#endif - // If we get here, we couldn't get to XScreenSaver: - MOZ_LOG(sIdleLog, LogLevel::Warning, ("XSSQueryExtension returned false!\n")); - return false; -diff --git a/widget/gtk/nsUserIdleServiceGTK.h b/widget/gtk/nsUserIdleServiceGTK.h -index 9b9ba31846..001f31a3a9 100644 ---- a/widget/gtk/nsUserIdleServiceGTK.h -+++ b/widget/gtk/nsUserIdleServiceGTK.h -@@ -9,6 +9,7 @@ - #define nsUserIdleServiceGTK_h__ - - #include "nsUserIdleService.h" -+#ifdef MOZ_X11 - #include - #include - #include -@@ -21,7 +22,7 @@ typedef struct { - unsigned long idle; // milliseconds idle - unsigned long event_mask; // event stuff - } XScreenSaverInfo; -- -+#endif - class nsUserIdleServiceGTK : public nsUserIdleService { - public: - NS_INLINE_DECL_REFCOUNTING_INHERITED(nsUserIdleServiceGTK, nsUserIdleService) -@@ -40,7 +41,6 @@ class nsUserIdleServiceGTK : public nsUserIdleService { - - private: - ~nsUserIdleServiceGTK(); -- XScreenSaverInfo* mXssInfo; - - protected: - nsUserIdleServiceGTK(); -diff --git a/widget/gtk/nsWidgetFactory.cpp b/widget/gtk/nsWidgetFactory.cpp -index d649c7e0bf..2f0f6223a4 100644 ---- a/widget/gtk/nsWidgetFactory.cpp -+++ b/widget/gtk/nsWidgetFactory.cpp -@@ -20,9 +20,7 @@ - #include "nsHTMLFormatConverter.h" - #include "HeadlessClipboard.h" - #include "IMContextWrapper.h" --#ifdef MOZ_X11 - # include "nsClipboard.h" --#endif - #include "TaskbarProgress.h" - #include "nsFilePicker.h" - #include "nsSound.h" -@@ -36,7 +34,6 @@ - using namespace mozilla; - using namespace mozilla::widget; - --#ifdef MOZ_X11 - NS_IMPL_COMPONENT_FACTORY(nsIClipboard) { - nsCOMPtr inst; - if (gfxPlatform::IsHeadless()) { -@@ -51,7 +48,6 @@ NS_IMPL_COMPONENT_FACTORY(nsIClipboard) { - - return inst.forget().downcast(); - } --#endif - - nsresult nsWidgetGtk2ModuleCtor() { return nsAppShellInit(); } - -diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp -index 620e2f47f2..6de82c3b36 100644 ---- a/widget/gtk/nsWindow.cpp -+++ b/widget/gtk/nsWindow.cpp -@@ -58,7 +58,6 @@ - #include "mozilla/UniquePtrExtensions.h" - #include "mozilla/WidgetUtils.h" - #include "mozilla/WritingModes.h" --#include "mozilla/X11Util.h" - #include "mozilla/XREAppData.h" - #include "NativeKeyBindings.h" - #include "nsAppDirectoryServiceDefs.h" -@@ -90,7 +89,6 @@ - #include "ScreenHelperGTK.h" - #include "SystemTimeConverter.h" - #include "WidgetUtilsGtk.h" --#include "mozilla/X11Util.h" - - #ifdef ACCESSIBILITY - # include "mozilla/a11y/LocalAccessible.h" -@@ -105,11 +103,13 @@ - # include - # include "gfxXlibSurface.h" - # include "GLContextGLX.h" // for GLContextGLX::FindVisual() --# include "GLContextEGL.h" // for GLContextEGL::FindVisual() - # include "WindowSurfaceX11Image.h" - # include "WindowSurfaceX11SHM.h" - #endif -+# include "GLContextEGL.h" // for GLContextEGL::FindVisual() - #ifdef MOZ_WAYLAND -+# include -+# include - # include "nsIClipboard.h" - # include "nsView.h" - #endif -@@ -119,7 +119,6 @@ using namespace mozilla::gfx; - using namespace mozilla::layers; - using namespace mozilla::widget; - using mozilla::gl::GLContextEGL; --using mozilla::gl::GLContextGLX; - - // Don't put more than this many rects in the dirty region, just fluff - // out to the bounding-box if there are more -@@ -275,7 +274,7 @@ static SystemTimeConverter& TimeConverter() { - bool nsWindow::sTransparentMainWindow = false; - - namespace mozilla { -- -+#ifdef MOZ_X11 - class CurrentX11TimeGetter { - public: - explicit CurrentX11TimeGetter(GdkWindow* aWindow) -@@ -323,6 +322,7 @@ class CurrentX11TimeGetter { - GdkWindow* mWindow; - TimeStamp mAsyncUpdateStart; - }; -+#endif - - } // namespace mozilla - -@@ -2526,6 +2526,7 @@ void nsWindow::SetSizeMode(nsSizeMode aMode) { - } - - static bool GetWindowManagerName(GdkWindow* gdk_window, nsACString& wmName) { -+#ifdef MOZ_X11 - if (!GdkIsX11Display()) { - return false; - } -@@ -2592,6 +2593,7 @@ static bool GetWindowManagerName(GdkWindow* gdk_window, nsACString& wmName) { - } - - wmName = reinterpret_cast(prop_return); -+#endif - return true; - } - -@@ -2646,12 +2648,9 @@ static bool WorkspaceManagementDisabled(GdkWindow* gdk_window) { - void nsWindow::GetWorkspaceID(nsAString& workspaceID) { - workspaceID.Truncate(); - -- if (!GdkIsX11Display() || !mShell) { -- return; -- } - - LOG("nsWindow::GetWorkspaceID()\n"); -- -+#ifdef MOZ_X11 - // Get the gdk window for this widget. - GdkWindow* gdk_window = gtk_widget_get_window(mShell); - if (!gdk_window) { -@@ -2684,9 +2683,11 @@ void nsWindow::GetWorkspaceID(nsAString& workspaceID) { - LOG(" got workspace ID %d", (int32_t)wm_desktop[0]); - workspaceID.AppendInt((int32_t)wm_desktop[0]); - g_free(wm_desktop); -+#endif - } - - void nsWindow::MoveToWorkspace(const nsAString& workspaceIDStr) { -+#ifdef MOZ_X11 - nsresult rv = NS_OK; - int32_t workspaceID = workspaceIDStr.ToInteger(&rv); - -@@ -2731,6 +2732,7 @@ void nsWindow::MoveToWorkspace(const nsAString& workspaceIDStr) { - - XFlush(xdisplay); - LOG(" moved to workspace"); -+#endif - } - - using SetUserTimeFunc = void (*)(GdkWindow*, guint32); -@@ -2771,9 +2773,7 @@ guint32 nsWindow::GetLastUserInputTime() { - // button and key releases. Therefore use the most recent of - // gdk_x11_display_get_user_time and the last time that we have seen. - GdkDisplay* gdkDisplay = gdk_display_get_default(); -- guint32 timestamp = GdkIsX11Display(gdkDisplay) -- ? gdk_x11_display_get_user_time(gdkDisplay) -- : gtk_get_current_event_time(); -+ guint32 timestamp = gtk_get_current_event_time(); - - if (sLastUserInputTime != GDK_CURRENT_TIME && - TimestampIsNewerThan(sLastUserInputTime, timestamp)) { -@@ -2936,7 +2936,7 @@ void nsWindow::UpdateClientOffsetFromFrameExtents() { - mClientOffset = nsIntPoint(0, 0); - return; - } -- -+#ifdef MOZ_X11 - GdkAtom cardinal_atom = gdk_x11_xatom_to_atom(XA_CARDINAL); - - GdkAtom type_returned; -@@ -2962,7 +2962,7 @@ void nsWindow::UpdateClientOffsetFromFrameExtents() { - - mClientOffset = nsIntPoint(left, top); - } -- -+#endif - // Send a WindowMoved notification. This ensures that BrowserParent - // picks up the new client offset and sends it to the child process - // if appropriate. -@@ -2973,13 +2973,12 @@ void nsWindow::UpdateClientOffsetFromFrameExtents() { - } - - LayoutDeviceIntPoint nsWindow::GetClientOffset() { -- return GdkIsX11Display() -- ? LayoutDeviceIntPoint::FromUnknownPoint(mClientOffset) -- : LayoutDeviceIntPoint(0, 0); -+ return LayoutDeviceIntPoint(0, 0); - } - - gboolean nsWindow::OnPropertyNotifyEvent(GtkWidget* aWidget, - GdkEventProperty* aEvent) { -+#ifdef MOZ_X11 - if (aEvent->atom == gdk_atom_intern("_NET_FRAME_EXTENTS", FALSE)) { - UpdateClientOffsetFromFrameExtents(); - return FALSE; -@@ -2990,6 +2989,7 @@ gboolean nsWindow::OnPropertyNotifyEvent(GtkWidget* aWidget, - if (GetCurrentTimeGetter()->PropertyNotifyHandler(aWidget, aEvent)) { - return TRUE; - } -+#endif - return FALSE; - } - -@@ -3127,9 +3127,11 @@ void* nsWindow::GetNativeData(uint32_t aDataType) { - return GetToplevelWidget(); - - case NS_NATIVE_WINDOW_WEBRTC_DEVICE_ID: -+#ifdef MOZ_X11 - if (GdkIsX11Display()) { - return (void*)GDK_WINDOW_XID(gdk_window_get_toplevel(mGdkWindow)); - } -+#endif - NS_WARNING( - "nsWindow::GetNativeData(): NS_NATIVE_WINDOW_WEBRTC_DEVICE_ID is not " - "handled on Wayland!"); -@@ -3150,14 +3152,14 @@ void* nsWindow::GetNativeData(uint32_t aDataType) { - return nullptr; - case NS_NATIVE_EGL_WINDOW: { - void* eglWindow = nullptr; -+#ifdef MOZ_X11 - if (GdkIsX11Display()) { - eglWindow = mGdkWindow ? (void*)GDK_WINDOW_XID(mGdkWindow) : nullptr; - } -+#endif - #ifdef MOZ_WAYLAND -- else { - eglWindow = moz_container_wayland_get_egl_window( - mContainer, FractionalScaleFactor()); -- } - #endif - LOG("Get NS_NATIVE_EGL_WINDOW window %p", eglWindow); - return eglWindow; -@@ -3478,7 +3480,7 @@ gboolean nsWindow::OnExposeEvent(cairo_t* cr) { - if (!listener) return FALSE; - - LOG("received expose event %p 0x%lx (rects follow):\n", mGdkWindow, -- GdkIsX11Display() ? gdk_x11_window_get_xid(mGdkWindow) : 0); -+ 0); - LayoutDeviceIntRegion exposeRegion; - if (!ExtractExposeRegion(exposeRegion, cr)) { - return FALSE; -@@ -3836,7 +3838,7 @@ void nsWindow::OnSizeAllocate(GtkAllocation* aAllocation) { - // we don't get _NET_FRAME_EXTENTS X11 property notification so we derive - // it from mContainer position. - if (mGtkWindowDecoration == GTK_DECORATION_CLIENT) { -- if (GdkIsWaylandDisplay() || (GdkIsX11Display() && mDrawInTitlebar)) { -+ if (GdkIsWaylandDisplay()) { - UpdateClientOffsetFromCSDWindow(); - } - } -@@ -4020,6 +4022,7 @@ void nsWindow::OnMotionNotifyEvent(GdkEventMotion* aEvent) { - MOZ_ASSERT(gdk_window, "gdk_window_get_toplevel should not return null"); - - bool canDrag = true; -+#ifdef MOZ_X11 - if (GdkIsX11Display()) { - // Workaround for https://bugzilla.gnome.org/show_bug.cgi?id=789054 - // To avoid crashes disable double-click on WM without _NET_WM_MOVERESIZE. -@@ -4030,7 +4033,7 @@ void nsWindow::OnMotionNotifyEvent(GdkEventMotion* aEvent) { - canDrag = false; - } - } -- -+#endif - if (canDrag) { - gdk_window_begin_move_drag(gdk_window, 1, aEvent->x_root, aEvent->y_root, - aEvent->time); -@@ -4472,7 +4475,6 @@ TimeStamp nsWindow::GetEventTimeStamp(guint32 aEventTime) { - - TimeStamp eventTimeStamp; - -- if (GdkIsWaylandDisplay()) { - // Wayland compositors use monotonic time to set timestamps. - int64_t timestampTime = g_get_monotonic_time() / 1000; - guint32 refTimeTruncated = guint32(timestampTime); -@@ -4481,16 +4483,9 @@ TimeStamp nsWindow::GetEventTimeStamp(guint32 aEventTime) { - int64_t tick = - BaseTimeDurationPlatformUtils::TicksFromMilliseconds(timestampTime); - eventTimeStamp = TimeStamp::FromSystemTime(tick); -- } else { -- CurrentX11TimeGetter* getCurrentTime = GetCurrentTimeGetter(); -- MOZ_ASSERT(getCurrentTime, -- "Null current time getter despite having a window"); -- eventTimeStamp = -- TimeConverter().GetTimeStampFromSystemTime(aEventTime, *getCurrentTime); -- } - return eventTimeStamp; - } -- -+#ifdef MOZ_X11 - mozilla::CurrentX11TimeGetter* nsWindow::GetCurrentTimeGetter() { - MOZ_ASSERT(mGdkWindow, "Expected mGdkWindow to be set"); - if (MOZ_UNLIKELY(!mCurrentTimeGetter)) { -@@ -4498,7 +4493,7 @@ mozilla::CurrentX11TimeGetter* nsWindow::GetCurrentTimeGetter() { - } - return mCurrentTimeGetter.get(); - } -- -+#endif - gboolean nsWindow::OnKeyPressEvent(GdkEventKey* aEvent) { - LOG("OnKeyPressEvent [%p]\n", (void*)this); - -@@ -4666,6 +4661,7 @@ void nsWindow::OnWindowStateEvent(GtkWidget* aWidget, - // - // This may be fixed in Gtk 3.24+ but some DE still have this issue - // (Bug 1624199) so let's remove it for Wayland only. -+#ifdef MOZ_X11 - if (GdkIsX11Display()) { - if (!mIsShown) { - aEvent->changed_mask = static_cast( -@@ -4676,7 +4672,7 @@ void nsWindow::OnWindowStateEvent(GtkWidget* aWidget, - aEvent->changed_mask | GDK_WINDOW_STATE_MAXIMIZED); - } - } -- -+#endif - // This is a workaround for https://gitlab.gnome.org/GNOME/gtk/issues/1395 - // Gtk+ controls window active appearance by window-state-event signal. - if (IsChromeWindowTitlebar() && -@@ -5160,9 +5156,6 @@ static void GtkWidgetDisableUpdates(GtkWidget* aWidget) { - void nsWindow::EnableRenderingToWindow() { - LOG("nsWindow::EnableRenderingToWindow()"); - -- if (mCompositorWidgetDelegate) { -- mCompositorWidgetDelegate->EnableRendering(mXWindow, mIsShaped); -- } - - if (GdkIsWaylandDisplay()) { - #ifdef MOZ_WAYLAND -@@ -5259,7 +5252,7 @@ void nsWindow::ConfigureGdkWindow() { - } - - LOG(" finished, new GdkWindow %p XID 0x%lx\n", mGdkWindow, -- GdkIsX11Display() ? gdk_x11_window_get_xid(mGdkWindow) : 0); -+ 0); - } - - void nsWindow::ReleaseGdkWindow() { -@@ -5389,9 +5382,6 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent, - if (mWindowType == eWindowType_popup) { - MOZ_ASSERT(aInitData); - type = GTK_WINDOW_POPUP; -- if (GdkIsX11Display() && mNoAutoHide) { -- type = GTK_WINDOW_TOPLEVEL; -- } - } - mShell = gtk_window_new(type); - -@@ -5512,6 +5502,7 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent, - GDK_WINDOW_TYPE_HINT_DND); - mIsDragPopup = true; - LOG_POPUP("nsWindow::Create() Drag popup [%p]\n", this); -+#ifdef MOZ_X11 - } else if (GdkIsX11Display()) { - // Set the window hints on X11 only. Wayland popups are configured - // at WaylandPopupNeedsTrackInHierarchy(). -@@ -5530,6 +5521,7 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent, - gtk_window_set_type_hint(GTK_WINDOW(mShell), gtkTypeHint); - LOG_POPUP("nsWindow::Create() popup type %s\n", - GetPopupTypeName().get()); -+#endif - } - if (parentnsWindow) { - LOG_POPUP(" set parent window [%p] %s\n", parentnsWindow, -@@ -5543,13 +5535,14 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent, - - // We need realized mShell at NativeMoveResize(). - gtk_widget_realize(mShell); -- -+#ifdef MOZ_X11 - if (GdkIsX11Display()) { - // With popup windows, we want to control their position, so don't - // wait for the window manager to place them (which wouldn't - // happen with override-redirect windows anyway). - NativeMoveResize(/* move */ true, /* resize */ false); - } -+#endif - } else { // must be eWindowType_toplevel - mGtkWindowRoleName = "Toplevel"; - SetDefaultIcon(); -@@ -5806,8 +5799,7 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent, - mIsPIPWindow ? "PIP window" : ""); - LOG("\tmShell %p mContainer %p mGdkWindow %p XID 0x%lx\n", mShell, mContainer, - mGdkWindow, -- (GdkIsX11Display() && mGdkWindow) ? gdk_x11_window_get_xid(mGdkWindow) -- : 0); -+ 0); - - // Set default application name when it's empty. - if (mGtkWindowAppName.IsEmpty()) { -@@ -5914,12 +5906,14 @@ void nsWindow::NativeMoveResize(bool aMoved, bool aResized) { - - // Set position to hidden window on X11 may fail, so save the position - // and move it when it's shown. -+#ifdef MOZ_X11 - if (aMoved && GdkIsX11Display() && IsPopup() && - !gtk_widget_get_visible(GTK_WIDGET(mShell))) { - LOG(" store position of hidden popup window"); - mHiddenPopupPositioned = true; - mPopupPosition = topLeft; - } -+#endif - - if (IsWaylandPopup()) { - NativeMoveResizeWaylandPopup(aMoved, aResized); -@@ -6654,7 +6648,7 @@ void nsWindow::UpdateTitlebarTransparencyBitmap() { - - cairo_surface_destroy(surface); - } -- -+#ifdef MOZ_X11 - if (!mNeedsShow) { - Display* xDisplay = GDK_WINDOW_XDISPLAY(mGdkWindow); - Window xDrawable = GDK_WINDOW_XID(mGdkWindow); -@@ -6675,6 +6669,7 @@ void nsWindow::UpdateTitlebarTransparencyBitmap() { - - XFreePixmap(xDisplay, maskPixmap); - } -+#endif - } - - void nsWindow::GrabPointer(guint32 aTime) { -@@ -6949,18 +6944,18 @@ static bool IsFullscreenSupported(GtkWidget* aShell) { - GdkScreen* screen = gtk_widget_get_screen(aShell); - GdkAtom atom = gdk_atom_intern("_NET_WM_STATE_FULLSCREEN", FALSE); - return gdk_x11_screen_supports_net_wm_hint(screen, atom); --#elif -+#else - return true; - #endif - } - - nsresult nsWindow::MakeFullScreen(bool aFullScreen, nsIScreen* aTargetScreen) { - LOG("nsWindow::MakeFullScreen aFullScreen %d\n", aFullScreen); -- -+#ifdef MOZ_X11 - if (GdkIsX11Display() && !IsFullscreenSupported(mShell)) { - return NS_ERROR_NOT_AVAILABLE; - } -- -+#endif - bool wasFullscreen = mSizeState == nsSizeMode_Fullscreen; - if (aFullScreen != wasFullscreen && mWidgetListener) { - mWidgetListener->FullscreenWillChange(aFullScreen); -@@ -8214,7 +8209,7 @@ bool nsWindow::GetDragInfo(WidgetMouseEvent* aMouseEvent, GdkWindow** aWindow, - if (!aMouseEvent->mWidget) { - return false; - } -- -+#ifdef MOZ_X11 - if (GdkIsX11Display()) { - // Workaround for https://bugzilla.gnome.org/show_bug.cgi?id=789054 - // To avoid crashes disable double-click on WM without _NET_WM_MOVERESIZE. -@@ -8230,7 +8225,7 @@ bool nsWindow::GetDragInfo(WidgetMouseEvent* aMouseEvent, GdkWindow** aWindow, - } - } - } -- -+#endif - // FIXME: It would be nice to have the widget position at the time - // of the event, but it's relatively unlikely that the widget has - // moved since the mousedown. (On the other hand, it's quite likely -@@ -8896,23 +8891,11 @@ nsWindow::GtkWindowDecoration nsWindow::GetSystemGtkWindowDecoration() { - bool nsWindow::TitlebarUseShapeMask() { - static int useShapeMask = []() { - // Don't use titlebar shape mask on Wayland -- if (!GdkIsX11Display()) { - return false; -- } - - // We can't use shape masks on Mutter/X.org as we can't resize Firefox - // window there (Bug 1530252). -- const char* currentDesktop = getenv("XDG_CURRENT_DESKTOP"); -- if (currentDesktop) { -- if (strstr(currentDesktop, "GNOME") != nullptr) { -- const char* sessionType = getenv("XDG_SESSION_TYPE"); -- if (sessionType && strstr(sessionType, "x11") != nullptr) { -- return false; -- } -- } -- } - -- return Preferences::GetBool("widget.titlebar-x11-use-shape-mask", false); - }(); - return useShapeMask; - } -@@ -8943,8 +8926,8 @@ void nsWindow::GetCompositorWidgetInitData( - } - #endif - *aInitData = mozilla::widget::GtkCompositorWidgetInitData( -- (mXWindow != X11None) ? mXWindow : (uintptr_t) nullptr, displayName, -- mIsShaped, GdkIsX11Display(), GetClientSize()); -+ (uintptr_t) nullptr, nsCString(), -+ 0, 0, GetClientSize()); - } - - #ifdef MOZ_X11 -diff --git a/widget/gtk/nsWindow.h b/widget/gtk/nsWindow.h -index 74d914328e..d0711e3726 100644 ---- a/widget/gtk/nsWindow.h -+++ b/widget/gtk/nsWindow.h -@@ -95,7 +95,6 @@ typedef struct _GdkEventTouchpadPinch GdkEventTouchpadPinch; - - namespace mozilla { - class TimeStamp; --class CurrentX11TimeGetter; - - } // namespace mozilla - -@@ -277,7 +276,6 @@ class nsWindow final : public nsBaseWidget { - - WidgetEventTime GetWidgetEventTime(guint32 aEventTime); - mozilla::TimeStamp GetEventTimeStamp(guint32 aEventTime); -- mozilla::CurrentX11TimeGetter* GetCurrentTimeGetter(); - - virtual void SetInputContext(const InputContext& aContext, - const InputContextAction& aAction) override; -@@ -819,7 +817,6 @@ class nsWindow final : public nsBaseWidget { - */ - RefPtr mIMContext; - -- mozilla::UniquePtr mCurrentTimeGetter; - static GtkWindowDecoration sGtkWindowDecoration; - - static bool sTransparentMainWindow; -diff --git a/widget/moz.build b/widget/moz.build -index 4724d667d8..48d0b4b1b6 100644 ---- a/widget/moz.build -+++ b/widget/moz.build -@@ -262,7 +262,7 @@ if CONFIG["MOZ_INSTRUMENT_EVENT_LOOP"]: - - EXPORTS.ipc = ["nsGUIEventIPC.h"] - --if CONFIG["MOZ_X11"]: -+if CONFIG["MOZ_X11"] or CONFIG["MOZ_WAYLAND"]: - DIRS += ["x11"] - - if toolkit in ("cocoa", "windows"): -@@ -309,7 +309,7 @@ if toolkit == "windows": - "windows/PCompositorWidget.ipdl", - "windows/PlatformWidgetTypes.ipdlh", - ] --elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk" and CONFIG["MOZ_X11"]: -+elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk": - IPDL_SOURCES = [ - "gtk/PCompositorWidget.ipdl", - "gtk/PlatformWidgetTypes.ipdlh", diff --git a/testing/firefox/post-install b/testing/firefox/post-install deleted file mode 100755 index 2f40c517..00000000 --- a/testing/firefox/post-install +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -cat <