From 2d08f989b16dad059d42c94e3a2cdccdbd3c379e Mon Sep 17 00:00:00 2001 From: Sine Striker <trueful@163.com> Date: 周一, 04 12月 2023 03:38:52 +0800 Subject: [PATCH] Add more comments --- src/core/contexts/abstractwindowcontext.cpp | 21 ++++++++++++++++++--- 1 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/core/contexts/abstractwindowcontext.cpp b/src/core/contexts/abstractwindowcontext.cpp index a6d4aeb..5c75d28 100644 --- a/src/core/contexts/abstractwindowcontext.cpp +++ b/src/core/contexts/abstractwindowcontext.cpp @@ -2,9 +2,7 @@ namespace QWK { - AbstractWindowContext::~AbstractWindowContext() { - delete m_delegate; - } + AbstractWindowContext::~AbstractWindowContext() = default; void AbstractWindowContext::setupWindow(QWindow *window) { Q_ASSERT(window); @@ -86,4 +84,21 @@ return hitTestVisibleShape; } + bool AbstractWindowContext::isInSystemButtons(const QPoint &pos, + CoreWindowAgent::SystemButton *button) const { + *button = CoreWindowAgent::Unknown; + for (int i = CoreWindowAgent::WindowIcon; i <= CoreWindowAgent::Close; ++i) { + auto currentButton = m_systemButtons[i]; + if (!currentButton || !m_delegate->isVisible(currentButton) || + !m_delegate->isEnabled(currentButton)) { + continue; + } + if (m_delegate->mapGeometryToScene(currentButton).contains(pos)) { + *button = CoreWindowAgent::WindowIcon; + return true; + } + } + return false; + } + } \ No newline at end of file -- Gitblit v1.9.1