repo/extra/firefox/patches/fix-wayland-only.patch

361 lines
11 KiB
Diff
Raw Normal View History

2022-06-27 10:34:31 -06:00
diff --git a/gfx/gl/GLContextProviderEGL.cpp b/gfx/gl/GLContextProviderEGL.cpp
index 2bf6de6..d2fce1f 100644
--- a/gfx/gl/GLContextProviderEGL.cpp
+++ b/gfx/gl/GLContextProviderEGL.cpp
@@ -79,6 +79,7 @@
# if defined(MOZ_WAYLAND)
# include <gdk/gdkwayland.h>
# include <wayland-egl.h>
+# include "mozilla/WidgetUtilsGtk.h"
# include "mozilla/widget/nsWaylandDisplay.h"
# endif
#endif
diff --git a/gfx/gl/GLContextProviderLinux.cpp b/gfx/gl/GLContextProviderLinux.cpp
index f8f6f3d..7205449 100644
--- a/gfx/gl/GLContextProviderLinux.cpp
+++ b/gfx/gl/GLContextProviderLinux.cpp
@@ -13,7 +13,9 @@ namespace mozilla::gl {
using namespace mozilla::gfx;
using namespace mozilla::widget;
+#ifdef MOZ_X11
static class GLContextProviderGLX sGLContextProviderGLX;
+#endif
static class GLContextProviderEGL sGLContextProviderEGL;
already_AddRefed<GLContext> GLContextProviderLinux::CreateForCompositorWidget(
@@ -22,9 +24,11 @@ already_AddRefed<GLContext> GLContextProviderLinux::CreateForCompositorWidget(
if (gfxVars::UseEGL()) {
return sGLContextProviderEGL.CreateForCompositorWidget(
aCompositorWidget, aHardwareWebRender, aForceAccelerated);
+#ifdef MOZ_X11
} else {
return sGLContextProviderGLX.CreateForCompositorWidget(
aCompositorWidget, aHardwareWebRender, aForceAccelerated);
+#endif
}
}
@@ -33,8 +37,10 @@ already_AddRefed<GLContext> GLContextProviderLinux::CreateHeadless(
const GLContextCreateDesc& desc, nsACString* const out_failureId) {
if (gfxVars::UseEGL()) {
return sGLContextProviderEGL.CreateHeadless(desc, out_failureId);
+#ifdef MOZ_X11
} else {
return sGLContextProviderGLX.CreateHeadless(desc, out_failureId);
+#endif
}
}
@@ -42,8 +48,10 @@ already_AddRefed<GLContext> GLContextProviderLinux::CreateHeadless(
GLContext* GLContextProviderLinux::GetGlobalContext() {
if (gfxVars::UseEGL()) {
return sGLContextProviderEGL.GetGlobalContext();
+#ifdef MOZ_X11
} else {
return sGLContextProviderGLX.GetGlobalContext();
+#endif
}
}
@@ -51,8 +59,10 @@ GLContext* GLContextProviderLinux::GetGlobalContext() {
void GLContextProviderLinux::Shutdown() {
if (gfxVars::UseEGL()) {
sGLContextProviderEGL.Shutdown();
+#ifdef MOZ_X11
} else {
sGLContextProviderGLX.Shutdown();
+#endif
}
}
diff --git a/gfx/gl/moz.build b/gfx/gl/moz.build
index bc492a8..fc0a005 100644
--- a/gfx/gl/moz.build
+++ b/gfx/gl/moz.build
@@ -108,10 +108,11 @@ elif gl_provider == "Linux":
# GLContextProviderGLX.cpp needs to be kept out of UNIFIED_SOURCES
# as it includes X11 headers which cause conflicts.
SOURCES += [
- "GLContextProviderGLX.cpp",
"GLContextProviderLinux.cpp",
]
EXPORTS += ["GLContextGLX.h", "GLXLibrary.h"]
+ if CONFIG["MOZ_X11"]:
+ SOURCES += ["GLContextProviderGLX.cpp"]
if CONFIG["MOZ_WAYLAND"]:
SOURCES += ["SharedSurfaceDMABUF.cpp"]
diff --git a/gfx/thebes/gfxPlatformGtk.cpp b/gfx/thebes/gfxPlatformGtk.cpp
index dd8dab6..34494ad 100644
--- a/gfx/thebes/gfxPlatformGtk.cpp
+++ b/gfx/thebes/gfxPlatformGtk.cpp
@@ -998,7 +998,7 @@ gfxPlatformGtk::CreateGlobalHardwareVsyncSource() {
RefPtr<VsyncSource> softwareVsync = new XrandrSoftwareVsyncSource();
return softwareVsync.forget();
#else
- return CreateSoftwareVsyncSource();
+ return GetSoftwareVsyncSource();
#endif
}
diff --git a/widget/gtk/CompositorWidgetParent.cpp b/widget/gtk/CompositorWidgetParent.cpp
index 4382ccf..9986146 100644
--- a/widget/gtk/CompositorWidgetParent.cpp
+++ b/widget/gtk/CompositorWidgetParent.cpp
@@ -6,9 +6,9 @@
#include "CompositorWidgetParent.h"
#include "mozilla/Unused.h"
#include "mozilla/widget/PlatformWidgetTypes.h"
+#include "nsWindow.h"
-namespace mozilla {
-namespace widget {
+namespace mozilla::widget {
CompositorWidgetParent::CompositorWidgetParent(
const CompositorWidgetInitData& aInitData,
@@ -51,5 +51,4 @@ mozilla::ipc::IPCResult CompositorWidgetParent::RecvEnableRendering(
return IPC_OK();
}
-} // namespace widget
-} // namespace mozilla
+} // namespace mozilla::widget
diff --git a/widget/gtk/GtkCompositorWidget.cpp b/widget/gtk/GtkCompositorWidget.cpp
index 07a1226..0a1d888 100644
--- a/widget/gtk/GtkCompositorWidget.cpp
+++ b/widget/gtk/GtkCompositorWidget.cpp
@@ -5,6 +5,7 @@
#include "GtkCompositorWidget.h"
+#include "mozilla/gfx/gfxVars.h"
#include "mozilla/layers/CompositorThread.h"
#include "mozilla/widget/InProcessCompositorWidget.h"
#include "mozilla/widget/PlatformWidgetTypes.h"
diff --git a/widget/gtk/IMContextWrapper.cpp b/widget/gtk/IMContextWrapper.cpp
2022-06-27 10:34:31 -06:00
index ccbe511..d9e7fe5 100644
--- a/widget/gtk/IMContextWrapper.cpp
+++ b/widget/gtk/IMContextWrapper.cpp
@@ -7,6 +7,7 @@
#include "mozilla/Logging.h"
#include "nsString.h"
#include "prtime.h"
+#include "prenv.h"
#include "IMContextWrapper.h"
#include "nsGtkKeyUtils.h"
diff --git a/widget/gtk/InProcessGtkCompositorWidget.cpp b/widget/gtk/InProcessGtkCompositorWidget.cpp
index 4158118..bffd6f5 100644
--- a/widget/gtk/InProcessGtkCompositorWidget.cpp
+++ b/widget/gtk/InProcessGtkCompositorWidget.cpp
@@ -8,10 +8,10 @@
#include "mozilla/widget/PlatformWidgetTypes.h"
#include "InProcessGtkCompositorWidget.h"
+#include "VsyncDispatcher.h"
#include "nsWindow.h"
-namespace mozilla {
-namespace widget {
+namespace mozilla::widget {
/* static */
RefPtr<CompositorWidget> CompositorWidget::CreateLocal(
@@ -41,5 +41,4 @@ void InProcessGtkCompositorWidget::ObserveVsync(VsyncObserver* aObserver) {
}
}
-} // namespace widget
-} // namespace mozilla
+} // namespace mozilla::widget
diff --git a/widget/gtk/MPRISServiceHandler.cpp b/widget/gtk/MPRISServiceHandler.cpp
2022-06-27 10:34:31 -06:00
index a8b4a43..9f95718 100644
--- a/widget/gtk/MPRISServiceHandler.cpp
+++ b/widget/gtk/MPRISServiceHandler.cpp
@@ -12,6 +12,7 @@
#include "MPRISInterfaceDescription.h"
#include "mozilla/dom/MediaControlUtils.h"
+#include "mozilla/GRefPtr.h"
#include "mozilla/GUniquePtr.h"
#include "mozilla/UniquePtrExtensions.h"
#include "mozilla/Maybe.h"
diff --git a/widget/gtk/WindowSurfaceX11.cpp b/widget/gtk/WindowSurfaceX11.cpp
index a32cc12..36b238a 100644
--- a/widget/gtk/WindowSurfaceX11.cpp
+++ b/widget/gtk/WindowSurfaceX11.cpp
@@ -6,10 +6,8 @@
#include "WindowSurfaceX11.h"
#include "gfxPlatform.h"
-#include "X11UndefineNone.h"
-namespace mozilla {
-namespace widget {
+namespace mozilla::widget {
WindowSurfaceX11::WindowSurfaceX11(Display* aDisplay, Window aWindow,
Visual* aVisual, unsigned int aDepth)
@@ -46,5 +44,4 @@ gfx::SurfaceFormat WindowSurfaceX11::GetVisualFormat(const Visual* aVisual,
return gfx::SurfaceFormat::UNKNOWN;
}
-} // namespace widget
-} // namespace mozilla
+} // namespace mozilla::widget
diff --git a/widget/gtk/WindowSurfaceX11.h b/widget/gtk/WindowSurfaceX11.h
index d297ec6..dda17bf 100644
--- a/widget/gtk/WindowSurfaceX11.h
+++ b/widget/gtk/WindowSurfaceX11.h
@@ -13,9 +13,9 @@
# include "mozilla/gfx/Types.h"
# include <X11/Xlib.h>
+# include "X11UndefineNone.h"
-namespace mozilla {
-namespace widget {
+namespace mozilla::widget {
class WindowSurfaceX11 : public WindowSurface {
public:
@@ -33,8 +33,7 @@ class WindowSurfaceX11 : public WindowSurface {
const gfx::SurfaceFormat mFormat;
};
-} // namespace widget
-} // namespace mozilla
+} // namespace mozilla::widget
#endif // MOZ_X11
#endif // _MOZILLA_WIDGET_GTK_WINDOW_SURFACE_X11_H
diff --git a/widget/gtk/moz.build b/widget/gtk/moz.build
index 5218c7d..2e578b9 100644
--- a/widget/gtk/moz.build
+++ b/widget/gtk/moz.build
@@ -187,6 +187,5 @@ if CONFIG["MOZ_ENABLE_DBUS"]:
"AsyncDBus.cpp",
]
CXXFLAGS += CONFIG["MOZ_DBUS_GLIB_CFLAGS"]
-CXXFLAGS += ["-Werror=switch"]
-REQUIRES_UNIFIED_BUILD = True
+CXXFLAGS += ["-Werror=switch"]
diff --git a/widget/gtk/mozgtk/moz.build b/widget/gtk/mozgtk/moz.build
index f860f82..d5e78d0 100644
--- a/widget/gtk/mozgtk/moz.build
+++ b/widget/gtk/mozgtk/moz.build
@@ -11,6 +11,7 @@ SOURCES += [
]
CFLAGS += CONFIG["MOZ_X11_CFLAGS"]
+CFLAGS += CONFIG["MOZ_GTK3_CFLAGS"]
# If LDFLAGS contains -Wl,--as-needed or if it's the default for the toolchain,
# we need to add -Wl,--no-as-needed before the gtk libraries, otherwise the
2022-06-06 00:12:53 -06:00
diff --git a/widget/gtk/mozgtk/mozgtk.c b/widget/gtk/mozgtk/mozgtk.c
index d7dbbc6..d95746f 100644
2022-06-06 00:12:53 -06:00
--- a/widget/gtk/mozgtk/mozgtk.c
+++ b/widget/gtk/mozgtk/mozgtk.c
@@ -6,6 +6,13 @@
2022-06-06 00:12:53 -06:00
#include "mozilla/Types.h"
+#include <gdk/gdk.h>
+
+// Dummy call to gtk3 library to prevent the linker from removing
+// the gtk3 dependency with --as-needed.
+// see toolkit/library/moz.build for details.
+MOZ_EXPORT void mozgtk_linker_holder() { gdk_display_get_default(); }
2022-06-06 00:12:53 -06:00
+
#ifdef MOZ_X11
# include <X11/Xlib.h>
// Bug 1271100
diff --git a/widget/gtk/nsApplicationChooser.cpp b/widget/gtk/nsApplicationChooser.cpp
index 2ebb62f..6752c52 100644
--- a/widget/gtk/nsApplicationChooser.cpp
+++ b/widget/gtk/nsApplicationChooser.cpp
@@ -11,6 +11,7 @@
#include "WidgetUtils.h"
#include "nsIMIMEInfo.h"
#include "nsIWidget.h"
+#include "nsIFile.h"
#include "nsCExternalHandlerService.h"
#include "nsComponentManagerUtils.h"
#include "nsGtkUtils.h"
2022-06-06 00:12:53 -06:00
diff --git a/widget/gtk/nsClipboard.cpp b/widget/gtk/nsClipboard.cpp
index 555e8ce..48a827f 100644
2022-06-06 00:12:53 -06:00
--- a/widget/gtk/nsClipboard.cpp
+++ b/widget/gtk/nsClipboard.cpp
@@ -31,15 +31,19 @@
#include "nsIObserverService.h"
#include "mozilla/Services.h"
#include "mozilla/RefPtr.h"
+#include "mozilla/GRefPtr.h"
2022-06-06 00:12:53 -06:00
#include "mozilla/SchedulerGroup.h"
#include "mozilla/StaticPrefs_widget.h"
#include "mozilla/TimeStamp.h"
+#include "GRefPtr.h"
#include "WidgetUtilsGtk.h"
2022-06-06 00:12:53 -06:00
#include "imgIContainer.h"
#include <gtk/gtk.h>
-#include <gtk/gtkx.h>
+#if defined(MOZ_X11)
+# include <gtk/gtkx.h>
+#endif
#include "mozilla/Encoding.h"
diff --git a/widget/gtk/nsGtkKeyUtils.h b/widget/gtk/nsGtkKeyUtils.h
index 6fcc3e9..8462b6d 100644
--- a/widget/gtk/nsGtkKeyUtils.h
+++ b/widget/gtk/nsGtkKeyUtils.h
@@ -20,6 +20,7 @@
# include <gdk/gdkwayland.h>
# include <xkbcommon/xkbcommon.h>
#endif
+#include "X11UndefineNone.h"
class nsWindow;
2022-06-06 00:12:53 -06:00
diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
2022-06-27 10:34:31 -06:00
index e6b54dc..cafd701 100644
2022-06-06 00:12:53 -06:00
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
2022-06-27 10:34:31 -06:00
@@ -268,6 +268,9 @@ static SystemTimeConverter<guint32>& TimeConverter() {
bool nsWindow::sTransparentMainWindow = false;
+// forward declare from mozgtk
+extern "C" MOZ_EXPORT void mozgtk_linker_holder();
+
namespace mozilla {
#ifdef MOZ_X11
2022-06-27 10:34:31 -06:00
@@ -429,6 +432,10 @@ nsWindow::nsWindow()
}
#endif
}
+ // Dummy call to mozgtk to prevent the linker from removing
+ // the dependency with --as-needed.
+ // see toolkit/library/moz.build for details.
+ mozgtk_linker_holder();
}
nsWindow::~nsWindow() {
2022-06-27 10:34:31 -06:00
@@ -5321,10 +5328,6 @@ void nsWindow::ConfigureGdkWindow() {
2022-06-06 00:12:53 -06:00
// tearing because Gecko does not align its framebuffer updates with
// vblank.
SetCompositorHint(GTK_WIDGET_COMPOSIDED_ENABLED);
-
- // Dummy call to a function in mozgtk to prevent the linker from removing
- // the dependency with --as-needed.
- XShmQueryExtension(DefaultXDisplay());
}
#endif
#ifdef MOZ_WAYLAND