From b1cc4e7de641a9e6ef866744d7775d45813bad8d Mon Sep 17 00:00:00 2001
From: Sine Striker <trueful@163.com>
Date: 周一, 11 12月 2023 23:47:11 +0800
Subject: [PATCH] clean codes

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

diff --git a/src/core/contexts/abstractwindowcontext_p.h b/src/core/contexts/abstractwindowcontext_p.h
index 28ff0de..967d002 100644
--- a/src/core/contexts/abstractwindowcontext_p.h
+++ b/src/core/contexts/abstractwindowcontext_p.h
@@ -9,12 +9,11 @@
 #include <QtGui/QPolygon>
 
 #include <QWKCore/windowagentbase.h>
-#include <QWKCore/sharedeventfilter.h>
 #include <QWKCore/private/windowitemdelegate_p.h>
 
 namespace QWK {
 
-    class QWK_CORE_EXPORT AbstractWindowContext : public QObject, public SharedEventDispatcher {
+    class QWK_CORE_EXPORT AbstractWindowContext : public QObject {
         Q_OBJECT
     public:
         AbstractWindowContext();
@@ -30,33 +29,43 @@
         bool setHitTestVisible(const QObject *obj, bool visible);
         bool setHitTestVisible(const QRect &rect, bool visible);
 
-        inline const QObject *systemButton(WindowAgentBase::SystemButton button) const;
-        bool setSystemButton(WindowAgentBase::SystemButton button, const QObject *obj);
+        inline QObject *systemButton(WindowAgentBase::SystemButton button) const;
+        bool setSystemButton(WindowAgentBase::SystemButton button, QObject *obj);
 
-        inline const QObject *titleBar() const;
-        bool setTitleBar(const QObject *obj);
+        inline QObject *titleBar() const;
+        bool setTitleBar(QObject *obj);
 
-        virtual void showSystemMenu(const QPoint &pos);
+        void showSystemMenu(const QPoint &pos);
 
         QRegion hitTestShape() const;
         bool isInSystemButtons(const QPoint &pos, WindowAgentBase::SystemButton *button) const;
         bool isInTitleBarDraggableArea(const QPoint &pos) const;
 
+        virtual QString key() const;
+
+        enum WindowContextHook {
+            CentralizeHook = 1,
+            ShowSystemMenuHook,
+            NeedsDrawBordersHook,
+            BorderThicknessHook,
+            BorderColorsHook,
+            DrawBordersHook,
+        };
+        virtual void virtual_hook(int id, void *data);
+
     protected:
         virtual bool setupHost() = 0;
 
-        QObject *target() const override;
-
     protected:
-        QObject *m_host;
+        QObject *m_host{};
         std::unique_ptr<WindowItemDelegate> m_delegate;
-        QWindow *m_windowHandle;
+        QWindow *m_windowHandle{};
 
         QSet<const QObject *> m_hitTestVisibleItems;
         QList<QRect> m_hitTestVisibleRects;
 
-        const QObject *m_titleBar{};
-        std::array<const QObject *, WindowAgentBase::NumSystemButton> m_systemButtons{};
+        QObject *m_titleBar{};
+        std::array<QObject *, WindowAgentBase::NumSystemButton> m_systemButtons{};
 
         // Cached shape
         mutable bool hitTestVisibleShapeDirty{};
@@ -75,12 +84,12 @@
         return m_hitTestVisibleItems.contains(obj);
     }
 
-    inline const QObject *
+    inline QObject *
         AbstractWindowContext::systemButton(WindowAgentBase::SystemButton button) const {
         return m_systemButtons[button];
     }
 
-    inline const QObject *AbstractWindowContext::titleBar() const {
+    inline QObject *AbstractWindowContext::titleBar() const {
         return m_titleBar;
     }
 

--
Gitblit v1.9.1