From 499afac952920595e6c3d4f94806427f894c7674 Mon Sep 17 00:00:00 2001 From: Sine Striker <trueful@163.com> Date: 周六, 02 12月 2023 19:05:24 +0800 Subject: [PATCH] optimize code --- src/core/contexts/abstractwindowcontext_p.h | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/core/contexts/abstractwindowcontext_p.h b/src/core/contexts/abstractwindowcontext_p.h index fd3a445..4c04734 100644 --- a/src/core/contexts/abstractwindowcontext_p.h +++ b/src/core/contexts/abstractwindowcontext_p.h @@ -1,6 +1,8 @@ #ifndef ABSTRACTWINDOWCONTEXT_P_H #define ABSTRACTWINDOWCONTEXT_P_H +#include <array> + #include <QtCore/QSet> #include <QtGui/QWindow> #include <QtGui/QPolygon> @@ -16,7 +18,7 @@ inline AbstractWindowContext(QWindow *window, WindowItemDelegate *delegate) : m_windowHandle(window), m_delegate(delegate) { } - ~AbstractWindowContext(); + ~AbstractWindowContext() override; public: virtual bool setup() = 0; @@ -36,6 +38,8 @@ void showSystemMenu(const QPoint &pos); + QRegion hitTestShape() const; + protected: QWindow *m_windowHandle; WindowItemDelegate *m_delegate; @@ -44,10 +48,11 @@ 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