mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-11-08 22:45:43 +00:00
178 lines
6.6 KiB
Diff
178 lines
6.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: stransky <stransky@redhat.com>
|
|
Date: Wed, 10 Jul 2024 10:59:52 +0000
|
|
Subject: [PATCH] Bug 1898476 [Wayland] Move MozContainerSurfaceLock from
|
|
MozContainerWayland to MozContainerSurfaceLock module r=emilio
|
|
|
|
Differential Revision: https://phabricator.services.mozilla.com/D214883
|
|
---
|
|
widget/gtk/MozContainerSurfaceLock.cpp | 31 ++++++++++++++++++++++++++
|
|
widget/gtk/MozContainerSurfaceLock.h | 28 +++++++++++++++++++++++
|
|
widget/gtk/MozContainerWayland.cpp | 17 --------------
|
|
widget/gtk/MozContainerWayland.h | 16 ++++++-------
|
|
widget/gtk/moz.build | 3 +++
|
|
5 files changed, 69 insertions(+), 26 deletions(-)
|
|
create mode 100644 widget/gtk/MozContainerSurfaceLock.cpp
|
|
create mode 100644 widget/gtk/MozContainerSurfaceLock.h
|
|
|
|
diff --git a/widget/gtk/MozContainerSurfaceLock.cpp b/widget/gtk/MozContainerSurfaceLock.cpp
|
|
new file mode 100644
|
|
index 000000000000..22e6baf0bd82
|
|
--- /dev/null
|
|
+++ b/widget/gtk/MozContainerSurfaceLock.cpp
|
|
@@ -0,0 +1,31 @@
|
|
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
+/* 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/. */
|
|
+
|
|
+#include "MozContainerSurfaceLock.h"
|
|
+#include "MozContainer.h"
|
|
+#include "WidgetUtilsGtk.h"
|
|
+
|
|
+using namespace mozilla::widget;
|
|
+
|
|
+MozContainerSurfaceLock::MozContainerSurfaceLock(MozContainer* aContainer) {
|
|
+#ifdef MOZ_WAYLAND
|
|
+ mContainer = aContainer;
|
|
+ if (GdkIsWaylandDisplay()) {
|
|
+ // mSurface can be nullptr if we lock hidden MozContainer and
|
|
+ // that's correct, MozContainer is still locked.
|
|
+ mSurface = moz_container_wayland_surface_lock(aContainer);
|
|
+ }
|
|
+#endif
|
|
+}
|
|
+
|
|
+MozContainerSurfaceLock::~MozContainerSurfaceLock() {
|
|
+#ifdef MOZ_WAYLAND
|
|
+ if (GdkIsWaylandDisplay()) {
|
|
+ moz_container_wayland_surface_unlock(mContainer, &mSurface);
|
|
+ }
|
|
+#endif
|
|
+}
|
|
+
|
|
+struct wl_surface* MozContainerSurfaceLock::GetSurface() { return mSurface; }
|
|
diff --git a/widget/gtk/MozContainerSurfaceLock.h b/widget/gtk/MozContainerSurfaceLock.h
|
|
new file mode 100644
|
|
index 000000000000..f96893b3f5b9
|
|
--- /dev/null
|
|
+++ b/widget/gtk/MozContainerSurfaceLock.h
|
|
@@ -0,0 +1,28 @@
|
|
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
+/* 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/. */
|
|
+
|
|
+#ifndef widget_gtk_MozContainerSurfaceLock_h
|
|
+#define widget_gtk_MozContainerSurfaceLock_h
|
|
+
|
|
+struct wl_surface;
|
|
+struct _MozContainer;
|
|
+typedef struct _MozContainer MozContainer;
|
|
+
|
|
+class MozContainerSurfaceLock {
|
|
+ public:
|
|
+ explicit MozContainerSurfaceLock(MozContainer* aContainer);
|
|
+ ~MozContainerSurfaceLock();
|
|
+
|
|
+ // wl_surface can be nullptr if we lock hidden MozContainer.
|
|
+ struct wl_surface* GetSurface();
|
|
+
|
|
+ private:
|
|
+#ifdef MOZ_WAYLAND
|
|
+ MozContainer* mContainer = nullptr;
|
|
+#endif
|
|
+ struct wl_surface* mSurface = nullptr;
|
|
+};
|
|
+
|
|
+#endif // widget_gtk_MozContainerSurfaceLock_h
|
|
diff --git a/widget/gtk/MozContainerWayland.cpp b/widget/gtk/MozContainerWayland.cpp
|
|
index 84c5e0a6642d..47e7cce6927b 100644
|
|
--- a/widget/gtk/MozContainerWayland.cpp
|
|
+++ b/widget/gtk/MozContainerWayland.cpp
|
|
@@ -87,23 +87,6 @@ static void moz_container_wayland_set_opaque_region_locked(
|
|
const MutexAutoLock& aProofOfLock, MozContainer* container,
|
|
const LayoutDeviceIntRegion&);
|
|
|
|
-// Lock mozcontainer and get wayland surface of it. You need to pair with
|
|
-// moz_container_wayland_surface_unlock() even
|
|
-// if moz_container_wayland_surface_lock() fails and returns nullptr.
|
|
-static struct wl_surface* moz_container_wayland_surface_lock(
|
|
- MozContainer* container);
|
|
-static void moz_container_wayland_surface_unlock(MozContainer* container,
|
|
- struct wl_surface** surface);
|
|
-
|
|
-MozContainerSurfaceLock::MozContainerSurfaceLock(MozContainer* aContainer) {
|
|
- mContainer = aContainer;
|
|
- mSurface = moz_container_wayland_surface_lock(aContainer);
|
|
-}
|
|
-MozContainerSurfaceLock::~MozContainerSurfaceLock() {
|
|
- moz_container_wayland_surface_unlock(mContainer, &mSurface);
|
|
-}
|
|
-struct wl_surface* MozContainerSurfaceLock::GetSurface() { return mSurface; }
|
|
-
|
|
// Invalidate gtk wl_surface to commit changes to wl_subsurface.
|
|
// wl_subsurface changes are effective when parent surface is commited.
|
|
static void moz_container_wayland_invalidate(MozContainer* container) {
|
|
diff --git a/widget/gtk/MozContainerWayland.h b/widget/gtk/MozContainerWayland.h
|
|
index 6a33df264279..6b1b07316955 100644
|
|
--- a/widget/gtk/MozContainerWayland.h
|
|
+++ b/widget/gtk/MozContainerWayland.h
|
|
@@ -13,6 +13,7 @@
|
|
#include <vector>
|
|
#include "mozilla/Mutex.h"
|
|
#include "WindowSurface.h"
|
|
+#include "MozContainerSurfaceLock.h"
|
|
|
|
/*
|
|
* MozContainer
|
|
@@ -61,15 +62,12 @@ struct _MozContainerClass;
|
|
typedef struct _MozContainer MozContainer;
|
|
typedef struct _MozContainerClass MozContainerClass;
|
|
|
|
-class MozContainerSurfaceLock {
|
|
- MozContainer* mContainer;
|
|
- struct wl_surface* mSurface;
|
|
-
|
|
- public:
|
|
- explicit MozContainerSurfaceLock(MozContainer* aContainer);
|
|
- ~MozContainerSurfaceLock();
|
|
- struct wl_surface* GetSurface();
|
|
-};
|
|
+// Lock mozcontainer and get wayland surface of it. You need to pair with
|
|
+// moz_container_wayland_surface_unlock() even
|
|
+// if moz_container_wayland_surface_lock() fails and returns nullptr.
|
|
+struct wl_surface* moz_container_wayland_surface_lock(MozContainer* container);
|
|
+void moz_container_wayland_surface_unlock(MozContainer* container,
|
|
+ struct wl_surface** surface);
|
|
|
|
void moz_container_wayland_map(GtkWidget*);
|
|
gboolean moz_container_wayland_map_event(GtkWidget*, GdkEventAny*);
|
|
diff --git a/widget/gtk/moz.build b/widget/gtk/moz.build
|
|
index 1567c006a457..6ced9be06e8f 100644
|
|
--- a/widget/gtk/moz.build
|
|
+++ b/widget/gtk/moz.build
|
|
@@ -33,6 +33,7 @@ if CONFIG["MOZ_ENABLE_V4L2"]:
|
|
|
|
EXPORTS += [
|
|
"MozContainer.h",
|
|
+ "MozContainerSurfaceLock.h",
|
|
"nsGTKToolkit.h",
|
|
"nsGtkUtils.h",
|
|
"nsImageToPixbuf.h",
|
|
@@ -71,6 +72,7 @@ UNIFIED_SOURCES += [
|
|
"IMContextWrapper.cpp",
|
|
"InProcessGtkCompositorWidget.cpp",
|
|
"MozContainer.cpp",
|
|
+ "MozContainerSurfaceLock.cpp",
|
|
"MPRISServiceHandler.cpp",
|
|
"NativeKeyBindings.cpp",
|
|
"NativeMenuGtk.cpp",
|
|
@@ -114,6 +116,7 @@ if CONFIG["MOZ_WAYLAND"]:
|
|
"WindowSurfaceWaylandMultiBuffer.cpp",
|
|
]
|
|
EXPORTS.mozilla.widget += [
|
|
+ "MozContainerSurfaceLock.h",
|
|
"MozContainerWayland.h",
|
|
"nsWaylandDisplay.h",
|
|
"WaylandBuffer.h",
|