2
0
mirror of https://codeberg.org/kiss-community/repo synced 2024-12-23 07:40:11 -07:00
repo/extra/firefox/patches/fix-wayland-only.patch

260 lines
7.7 KiB
Diff

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
index cc84d40..e2180f5 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
index ad85082..e21e46f 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
diff --git a/widget/gtk/mozgtk/mozgtk.c b/widget/gtk/mozgtk/mozgtk.c
index d7dbbc6..d95746f 100644
--- a/widget/gtk/mozgtk/mozgtk.c
+++ b/widget/gtk/mozgtk/mozgtk.c
@@ -6,6 +6,13 @@
#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(); }
+
#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"
diff --git a/widget/gtk/nsClipboard.cpp b/widget/gtk/nsClipboard.cpp
index 555e8ce..48a827f 100644
--- 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"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/StaticPrefs_widget.h"
#include "mozilla/TimeStamp.h"
+#include "GRefPtr.h"
#include "WidgetUtilsGtk.h"
#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;
diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
index e14c4f4..cd82d54 100644
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -267,6 +267,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
@@ -426,6 +429,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() {
@@ -5302,10 +5309,6 @@ void nsWindow::ConfigureGdkWindow() {
// 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