From 51039917996909284fbc2d776a9b8f71fe5e6f9a Mon Sep 17 00:00:00 2001
From: Zhao Yuhang <2546789017@qq.com>
Date: 周六, 02 12月 2023 17:43:17 +0800
Subject: [PATCH] wip

---
 src/core/contexts/abstractwindowcontext_p.h |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/core/contexts/abstractwindowcontext_p.h b/src/core/contexts/abstractwindowcontext_p.h
index fd3a445..a633b18 100644
--- a/src/core/contexts/abstractwindowcontext_p.h
+++ b/src/core/contexts/abstractwindowcontext_p.h
@@ -12,11 +12,14 @@
 
     class QWK_CORE_EXPORT AbstractWindowContext : public QObject {
         Q_OBJECT
+        Q_DISABLE_COPY(AbstractWindowContext)
+
     public:
-        inline AbstractWindowContext(QWindow *window, WindowItemDelegate *delegate)
-            : m_windowHandle(window), m_delegate(delegate) {
+        inline AbstractWindowContext(QWindow *window, WindowItemDelegatePtr delegate)
+            : m_windowHandle(window), m_delegate(std::move(delegate))
+        {
         }
-        ~AbstractWindowContext();
+        ~AbstractWindowContext() override;
 
     public:
         virtual bool setup() = 0;
@@ -38,13 +41,13 @@
 
     protected:
         QWindow *m_windowHandle;
-        WindowItemDelegate *m_delegate;
+        WindowItemDelegatePtr m_delegate;
 
         QSet<QObject *> m_hitTestVisibleItems;
         QList<QRect> m_hitTestVisibleRects;
 
         QObject *m_titleBar{};
-        QObject *m_systemButtons[CoreWindowAgent::NumSystemButton]{};
+        std::array<QObject *, CoreWindowAgent::NumSystemButton> m_systemButtons{};
 
         mutable bool hitTestVisibleShapeDirty{};
         mutable QPolygon hitTestVisibleShape;
@@ -67,6 +70,8 @@
         return m_titleBar;
     }
 
+    using WindowContextPtr = std::shared_ptr<AbstractWindowContext>;
+
 }
 
 #endif // ABSTRACTWINDOWCONTEXT_P_H

--
Gitblit v1.9.1