PKGBUILDs/extra/firefox/0002-Bug-1898476-Wayland-Provide-surface-lock-by-GtkCompo.patch

89 lines
2.9 KiB
Diff
Raw Normal View History

2024-07-19 12:47:46 +00:00
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 297149796986..28c0cb2641e2 100644
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -10218,3 +10218,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 1dd1f1dce8f4..98cec928817f 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"
@@ -422,6 +423,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);