PKGBUILDs/extra/firefox/0002-Bug-1898476-Wayland-Provide-surface-lock-by-GtkCompo.patch
2024-08-06 15:33:37 -04:00

88 lines
2.9 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: stransky <stransky@redhat.com>
Date: Wed, 10 Jul 2024 10:59:53 +0000
Subject: [PATCH] Bug 1898476 [Wayland] Provide surface lock by
GtkCompositorWidget r=emilio
Depends on D214883
Differential Revision: https://phabricator.services.mozilla.com/D214884
---
widget/gtk/GtkCompositorWidget.cpp | 4 ++++
widget/gtk/GtkCompositorWidget.h | 4 ++++
widget/gtk/nsWindow.cpp | 7 +++++++
widget/gtk/nsWindow.h | 3 +++
4 files changed, 18 insertions(+)
diff --git a/widget/gtk/GtkCompositorWidget.cpp b/widget/gtk/GtkCompositorWidget.cpp
index 50eb90a0c860..65b9dd3f49e0 100644
--- a/widget/gtk/GtkCompositorWidget.cpp
+++ b/widget/gtk/GtkCompositorWidget.cpp
@@ -211,5 +211,9 @@ bool GtkCompositorWidget::IsPopup() {
}
#endif
+UniquePtr<MozContainerSurfaceLock> GtkCompositorWidget::LockSurface() {
+ return mWidget->LockSurface();
+}
+
} // namespace widget
} // namespace mozilla
diff --git a/widget/gtk/GtkCompositorWidget.h b/widget/gtk/GtkCompositorWidget.h
index d4834247f16d..8d56f35a561c 100644
--- a/widget/gtk/GtkCompositorWidget.h
+++ b/widget/gtk/GtkCompositorWidget.h
@@ -10,6 +10,8 @@
#include "mozilla/DataMutex.h"
#include "mozilla/widget/CompositorWidget.h"
#include "WindowSurfaceProvider.h"
+#include "mozilla/UniquePtr.h"
+#include "MozContainerSurfaceLock.h"
class nsIWidget;
class nsWindow;
@@ -96,6 +98,8 @@ class GtkCompositorWidget : public CompositorWidget,
void NotifyClientSizeChanged(const LayoutDeviceIntSize& aClientSize) override;
GtkCompositorWidget* AsGtkCompositorWidget() override { return this; }
+ UniquePtr<MozContainerSurfaceLock> LockSurface();
+
private:
#if defined(MOZ_WAYLAND)
void ConfigureWaylandBackend();
diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
index b78ad4ca286b..40594a0e6f2f 100644
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -10276,3 +10276,10 @@ void nsWindow::SetDragSource(GdkDragContext* aSourceDragContext) {
}
}
}
+
+UniquePtr<MozContainerSurfaceLock> nsWindow::LockSurface() {
+ if (mIsDestroyed) {
+ return nullptr;
+ }
+ return MakeUnique<MozContainerSurfaceLock>(mContainer);
+}
diff --git a/widget/gtk/nsWindow.h b/widget/gtk/nsWindow.h
index 36b039cc5e58..ce57689fcc15 100644
--- a/widget/gtk/nsWindow.h
+++ b/widget/gtk/nsWindow.h
@@ -13,6 +13,7 @@
#include "CompositorWidget.h"
#include "MozContainer.h"
+#include "MozContainerSurfaceLock.h"
#include "VsyncSource.h"
#include "mozilla/EventForwards.h"
#include "mozilla/Maybe.h"
@@ -421,6 +422,8 @@ class nsWindow final : public nsBaseWidget {
static nsWindow* GetFocusedWindow();
+ mozilla::UniquePtr<MozContainerSurfaceLock> LockSurface();
+
#ifdef MOZ_WAYLAND
// Use xdg-activation protocol to transfer focus from gFocusWindow to aWindow.
static void TransferFocusToWaylandWindow(nsWindow* aWindow);