From 6189c14c042d701c683f8dfaa0d44c8f1463c3b0 Mon Sep 17 00:00:00 2001 From: Sine Striker <trueful@163.com> Date: 周一, 04 12月 2023 15:22:25 +0800 Subject: [PATCH] minor tweaks --- src/core/contexts/abstractwindowcontext_p.h | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/core/contexts/abstractwindowcontext_p.h b/src/core/contexts/abstractwindowcontext_p.h index fd3a445..83ad768 100644 --- a/src/core/contexts/abstractwindowcontext_p.h +++ b/src/core/contexts/abstractwindowcontext_p.h @@ -1,6 +1,9 @@ #ifndef ABSTRACTWINDOWCONTEXT_P_H #define ABSTRACTWINDOWCONTEXT_P_H +#include <array> +#include <memory> + #include <QtCore/QSet> #include <QtGui/QWindow> #include <QtGui/QPolygon> @@ -16,7 +19,7 @@ inline AbstractWindowContext(QWindow *window, WindowItemDelegate *delegate) : m_windowHandle(window), m_delegate(delegate) { } - ~AbstractWindowContext(); + ~AbstractWindowContext() override; public: virtual bool setup() = 0; @@ -36,18 +39,22 @@ void showSystemMenu(const QPoint &pos); + QRegion hitTestShape() const; + bool isInSystemButtons(const QPoint &pos, CoreWindowAgent::SystemButton *button) const; + protected: QWindow *m_windowHandle; - WindowItemDelegate *m_delegate; + std::unique_ptr<WindowItemDelegate> 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{}; + // Cached shape mutable bool hitTestVisibleShapeDirty{}; - mutable QPolygon hitTestVisibleShape; + mutable QRegion hitTestVisibleShape; }; inline QWindow *AbstractWindowContext::window() const { -- Gitblit v1.9.1