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

source code of qtwayland/src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h