From 52a662ed17db6c3a3ff2050d61bc2e06ea21b056 Mon Sep 17 00:00:00 2001
From: Sine Striker <trueful@163.com>
Date: 周日, 17 12月 2023 01:07:13 +0800
Subject: [PATCH] Add Mac system button area interfaces

---
 src/core/contexts/abstractwindowcontext.cpp |   32 +++++---------------------------
 1 files changed, 5 insertions(+), 27 deletions(-)

diff --git a/src/core/contexts/abstractwindowcontext.cpp b/src/core/contexts/abstractwindowcontext.cpp
index 3b2340f..7c40c89 100644
--- a/src/core/contexts/abstractwindowcontext.cpp
+++ b/src/core/contexts/abstractwindowcontext.cpp
@@ -48,21 +48,6 @@
         return true;
     }
 
-    bool AbstractWindowContext::setHitTestVisible(const QRect &rect, bool visible) {
-        Q_ASSERT(rect.isValid());
-        if (!rect.isValid()) {
-            return false;
-        }
-
-        if (visible) {
-            m_hitTestVisibleRects.append(rect);
-        } else {
-            m_hitTestVisibleRects.removeAll(rect);
-        }
-        hitTestVisibleShapeDirty = true;
-        return true;
-    }
-
     bool AbstractWindowContext::setSystemButton(WindowAgentBase::SystemButton button,
                                                 QObject *obj) {
         Q_ASSERT(obj);
@@ -91,16 +76,12 @@
         return true;
     }
 
-    QRegion AbstractWindowContext::hitTestShape() const {
-        if (hitTestVisibleShapeDirty) {
-            hitTestVisibleShape = {};
-            for (const auto &rect : m_hitTestVisibleRects) {
-                hitTestVisibleShape += rect;
-            }
-            hitTestVisibleShapeDirty = false;
-        }
-        return hitTestVisibleShape;
+#ifdef Q_OS_MAC
+    void AbstractWindowContext::setSystemButtonArea(const QRect &rect) {
+        m_systemButtonArea = rect;
+        virtual_hook(SystemButtonAreaChangedHook, nullptr);
     }
+#endif
 
     bool AbstractWindowContext::isInSystemButtons(const QPoint &pos,
                                                   WindowAgentBase::SystemButton *button) const {
@@ -157,9 +138,6 @@
             }
         }
 
-        if (!m_hitTestVisibleRects.isEmpty() && hitTestShape().contains(pos)) {
-            return false;
-        }
         return true;
     }
 

--
Gitblit v1.9.1