From a0bede6ff6a700a6eea9702c49d378f07de22f63 Mon Sep 17 00:00:00 2001 From: Sine Striker <trueful@163.com> Date: 周三, 06 12月 2023 12:11:37 +0800 Subject: [PATCH] Fix title bar hover bug --- src/core/contexts/abstractwindowcontext_p.h | 16 +++++++++++----- 1 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/core/contexts/abstractwindowcontext_p.h b/src/core/contexts/abstractwindowcontext_p.h index 4c04734..996a0e3 100644 --- a/src/core/contexts/abstractwindowcontext_p.h +++ b/src/core/contexts/abstractwindowcontext_p.h @@ -2,6 +2,7 @@ #define ABSTRACTWINDOWCONTEXT_P_H #include <array> +#include <memory> #include <QtCore/QSet> #include <QtGui/QWindow> @@ -15,16 +16,14 @@ class QWK_CORE_EXPORT AbstractWindowContext : public QObject { Q_OBJECT public: - inline AbstractWindowContext(QWindow *window, WindowItemDelegate *delegate) - : m_windowHandle(window), m_delegate(delegate) { - } + AbstractWindowContext(QObject *host, WindowItemDelegate *delegate); ~AbstractWindowContext() override; public: virtual bool setup() = 0; + inline QObject *host() const; inline QWindow *window() const; - void setupWindow(QWindow *window); inline bool isHitTestVisible(QObject *obj) const; bool setHitTestVisible(QObject *obj, bool visible); @@ -39,10 +38,13 @@ void showSystemMenu(const QPoint &pos); QRegion hitTestShape() const; + bool isInSystemButtons(const QPoint &pos, CoreWindowAgent::SystemButton *button) const; + bool isInTitleBarDraggableArea(const QPoint &pos) const; protected: + QObject *m_host; + std::unique_ptr<WindowItemDelegate> m_delegate; QWindow *m_windowHandle; - WindowItemDelegate *m_delegate; QSet<QObject *> m_hitTestVisibleItems; QList<QRect> m_hitTestVisibleRects; @@ -55,6 +57,10 @@ mutable QRegion hitTestVisibleShape; }; + inline QObject *AbstractWindowContext::host() const { + return m_host; + } + inline QWindow *AbstractWindowContext::window() const { return m_windowHandle; } -- Gitblit v1.9.1