From eb266da10552eeefcb0f7dfe514d4385aec563f8 Mon Sep 17 00:00:00 2001 From: Sine Striker <trueful@163.com> Date: 周日, 03 12月 2023 05:05:23 +0800 Subject: [PATCH] Add windows context implementation --- src/core/contexts/abstractwindowcontext.cpp | 22 ++++++++++++++++++---- 1 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/core/contexts/abstractwindowcontext.cpp b/src/core/contexts/abstractwindowcontext.cpp index 0cefb8b..920e210 100644 --- a/src/core/contexts/abstractwindowcontext.cpp +++ b/src/core/contexts/abstractwindowcontext.cpp @@ -2,11 +2,13 @@ namespace QWK { - AbstractWindowContext::~AbstractWindowContext() { - delete m_delegate; - } + AbstractWindowContext::~AbstractWindowContext() = default; void AbstractWindowContext::setupWindow(QWindow *window) { + Q_ASSERT(window); + if (!window) { + return; + } m_windowHandle = window; } @@ -35,11 +37,12 @@ } else { m_hitTestVisibleRects.removeAll(rect); } + hitTestVisibleShapeDirty = true; return true; } bool AbstractWindowContext::setSystemButton(CoreWindowAgent::SystemButton button, - QObject *obj) { + QObject *obj) { Q_ASSERT(obj); Q_ASSERT(button != CoreWindowAgent::Unknown); if (!obj || (button == CoreWindowAgent::Unknown)) { @@ -70,4 +73,15 @@ // ? } + QRegion AbstractWindowContext::hitTestShape() const { + if (hitTestVisibleShapeDirty) { + hitTestVisibleShape = {}; + for (const auto &rect : m_hitTestVisibleRects) { + hitTestVisibleShape += rect; + } + hitTestVisibleShapeDirty = false; + } + return hitTestVisibleShape; + } + } \ No newline at end of file -- Gitblit v1.9.1