1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2017 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the QtWaylandCompositor module of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:GPL$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU |
19 | ** General Public License version 3 or (at your option) any later version |
20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by |
21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 |
22 | ** included in the packaging of this file. Please review the following |
23 | ** information to ensure the GNU General Public License requirements will |
24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
25 | ** |
26 | ** $QT_END_LICENSE$ |
27 | ** |
28 | ****************************************************************************/ |
29 | |
30 | #ifndef QWAYLANDXDGSHELLV5INTEGRATION_H |
31 | #define QWAYLANDXDGSHELLV5INTEGRATION_H |
32 | |
33 | #include <QtWaylandCompositor/private/qwaylandquickshellsurfaceitem_p.h> |
34 | #include <QtWaylandCompositor/QWaylandXdgSurfaceV5> |
35 | |
36 | QT_BEGIN_NAMESPACE |
37 | |
38 | #if QT_DEPRECATED_SINCE(5, 15) |
39 | |
40 | // |
41 | // W A R N I N G |
42 | // ------------- |
43 | // |
44 | // This file is not part of the Qt API. It exists purely as an |
45 | // implementation detail. This header file may change from version to |
46 | // version without notice, or even be removed. |
47 | // |
48 | // We mean it. |
49 | // |
50 | |
51 | namespace QtWayland { |
52 | |
53 | class XdgShellV5Integration : public QWaylandQuickShellIntegration |
54 | { |
55 | Q_OBJECT |
56 | public: |
57 | XdgShellV5Integration(QWaylandQuickShellSurfaceItem *item); |
58 | ~XdgShellV5Integration() override; |
59 | |
60 | protected: |
61 | bool eventFilter(QObject *object, QEvent *event) override; |
62 | |
63 | private Q_SLOTS: |
64 | void handleStartMove(QWaylandSeat *seat); |
65 | void handleStartResize(QWaylandSeat *seat, QWaylandXdgSurfaceV5::ResizeEdge edges); |
66 | void handleSetTopLevel(); |
67 | void handleSetTransient(); |
68 | void handleSetMaximized(); |
69 | void handleUnsetMaximized(); |
70 | void handleMaximizedChanged(); |
71 | void handleActivatedChanged(); |
72 | void handleSurfaceSizeChanged(); |
73 | |
74 | private: |
75 | enum class GrabberState { |
76 | Default, |
77 | Resize, |
78 | Move |
79 | }; |
80 | QWaylandQuickShellSurfaceItem *m_item = nullptr; |
81 | QWaylandXdgSurfaceV5 *m_xdgSurface = nullptr; |
82 | |
83 | GrabberState grabberState; |
84 | struct { |
85 | QWaylandSeat *seat = nullptr; |
86 | QPointF initialOffset; |
87 | bool initialized = false; |
88 | } moveState; |
89 | |
90 | struct { |
91 | QWaylandSeat *seat = nullptr; |
92 | QWaylandXdgSurfaceV5::ResizeEdge resizeEdges; |
93 | QSizeF initialWindowSize; |
94 | QPointF initialMousePos; |
95 | QPointF initialPosition; |
96 | QSize initialSurfaceSize; |
97 | bool initialized = false; |
98 | } resizeState; |
99 | |
100 | struct { |
101 | QSize initialWindowSize; |
102 | QPointF initialPosition; |
103 | } maximizeState; |
104 | |
105 | bool filterMouseMoveEvent(QMouseEvent *event); |
106 | bool filterMouseReleaseEvent(QMouseEvent *event); |
107 | }; |
108 | |
109 | class XdgPopupV5Integration : public QWaylandQuickShellIntegration |
110 | { |
111 | Q_OBJECT |
112 | public: |
113 | XdgPopupV5Integration(QWaylandQuickShellSurfaceItem *item); |
114 | ~XdgPopupV5Integration() override; |
115 | |
116 | private Q_SLOTS: |
117 | void handlePopupDestroyed(); |
118 | |
119 | private: |
120 | QWaylandQuickShellSurfaceItem *m_item = nullptr; |
121 | QWaylandXdgPopupV5 *m_xdgPopup = nullptr; |
122 | QWaylandXdgShellV5 *m_xdgShell = nullptr; |
123 | }; |
124 | |
125 | } |
126 | |
127 | #endif // QT_DEPRECATED_SINCE(5, 15) |
128 | |
129 | QT_END_NAMESPACE |
130 | |
131 | #endif // QWAYLANDXDGSHELLV5INTEGRATION_H |
132 | |