| 1 | // Copyright (C) 2017 The Qt Company Ltd. | 
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only | 
| 3 | |
| 4 | #ifndef QWAYLANDQUICKSHELLSURFACEITEM_P_H | 
| 5 | #define QWAYLANDQUICKSHELLSURFACEITEM_P_H | 
| 6 | |
| 7 | #include <QtWaylandCompositor/QWaylandQuickShellSurfaceItem> | 
| 8 | #include <QtWaylandCompositor/QWaylandQuickShellIntegration> | 
| 9 | #include <QtWaylandCompositor/private/qwaylandquickitem_p.h> | 
| 10 | |
| 11 | #include <QtCore/QBasicTimer> | 
| 12 | #include <QtCore/qpointer.h> | 
| 13 | |
| 14 | #include <functional> | 
| 15 | |
| 16 | QT_BEGIN_NAMESPACE | 
| 17 | |
| 18 | // | 
| 19 | // W A R N I N G | 
| 20 | // ------------- | 
| 21 | // | 
| 22 | // This file is not part of the Qt API. It exists purely as an | 
| 23 | // implementation detail. This header file may change from version to | 
| 24 | // version without notice, or even be removed. | 
| 25 | // | 
| 26 | // We mean it. | 
| 27 | // | 
| 28 | |
| 29 | class QWaylandShellSurface; | 
| 30 | class QWaylandQuickShellSurfaceItem; | 
| 31 | |
| 32 | class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandQuickShellSurfaceItemPrivate : public QWaylandQuickItemPrivate | 
| 33 | { | 
| 34 | Q_DECLARE_PUBLIC(QWaylandQuickShellSurfaceItem) | 
| 35 | public: | 
| 36 | QWaylandQuickShellSurfaceItemPrivate() {} | 
| 37 | QWaylandQuickShellSurfaceItem *maybeCreateAutoPopup(QWaylandShellSurface* shellSurface); | 
| 38 | static QWaylandQuickShellSurfaceItemPrivate *get(QWaylandQuickShellSurfaceItem *item) { return item->d_func(); } | 
| 39 | |
| 40 | void raise() override; | 
| 41 | void lower() override; | 
| 42 | |
| 43 | QWaylandQuickShellIntegration *m_shellIntegration = nullptr; | 
| 44 | QPointer<QWaylandShellSurface> m_shellSurface = nullptr; | 
| 45 | QQuickItem *m_moveItem = nullptr; | 
| 46 | bool m_autoCreatePopupItems = true; | 
| 47 | bool staysOnTop = false; | 
| 48 | bool staysOnBottom = false; | 
| 49 | }; | 
| 50 | |
| 51 | class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandQuickShellEventFilter : public QObject | 
| 52 | { | 
| 53 | Q_OBJECT | 
| 54 | public: | 
| 55 | typedef std::function<void()> CallbackFunction; | 
| 56 | static void startFilter(QWaylandClient *client, CallbackFunction closePopupCallback); | 
| 57 | static void cancelFilter(); | 
| 58 | |
| 59 | protected: | 
| 60 | void timerEvent(QTimerEvent *event) override; | 
| 61 | |
| 62 | private: | 
| 63 | void stopFilter(); | 
| 64 | |
| 65 | QWaylandQuickShellEventFilter(QObject *parent = nullptr); | 
| 66 | bool eventFilter(QObject *, QEvent *) override; | 
| 67 | bool eventFilterInstalled = false; | 
| 68 | bool waitForRelease = false; | 
| 69 | QPointer<QWaylandClient> client; | 
| 70 | CallbackFunction closePopups = nullptr; | 
| 71 | QBasicTimer mousePressTimeout; | 
| 72 | static QWaylandQuickShellEventFilter *self; | 
| 73 | }; | 
| 74 | |
| 75 | QT_END_NAMESPACE | 
| 76 | |
| 77 | #endif // QWAYLANDQUICKSHELLSURFACEITEM_P_H | 
| 78 | 
