1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2016 The Qt Company Ltd. |
4 | ** Contact: http://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the QtWaylandCompositor module of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:LGPL3$ |
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 http://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at http://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU Lesser General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the |
21 | ** packaging of this file. Please review the following information to |
22 | ** ensure the GNU Lesser General Public License version 3 requirements |
23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. |
24 | ** |
25 | ** GNU General Public License Usage |
26 | ** Alternatively, this file may be used under the terms of the GNU |
27 | ** General Public License version 2.0 or later as published by the Free |
28 | ** Software Foundation and appearing in the file LICENSE.GPL included in |
29 | ** the packaging of this file. Please review the following information to |
30 | ** ensure the GNU General Public License version 2.0 requirements will be |
31 | ** met: http://www.gnu.org/licenses/gpl-2.0.html. |
32 | ** |
33 | ** $QT_END_LICENSE$ |
34 | ** |
35 | ****************************************************************************/ |
36 | |
37 | #ifndef QWAYLANDXDGSHELLV6INTEGRATION_H |
38 | #define QWAYLANDXDGSHELLV6INTEGRATION_H |
39 | |
40 | #include <QtWaylandCompositor/private/qwaylandquickshellsurfaceitem_p.h> |
41 | #include <QtWaylandCompositor/QWaylandQuickShellSurfaceItem> |
42 | #include <QtWaylandCompositor/QWaylandXdgToplevelV6> |
43 | |
44 | QT_BEGIN_NAMESPACE |
45 | |
46 | #if QT_DEPRECATED_SINCE(5, 15) |
47 | |
48 | // |
49 | // W A R N I N G |
50 | // ------------- |
51 | // |
52 | // This file is not part of the Qt API. It exists purely as an |
53 | // implementation detail. This header file may change from version to |
54 | // version without notice, or even be removed. |
55 | // |
56 | // We mean it. |
57 | // |
58 | |
59 | class QWaylandXdgSurfaceV6; |
60 | |
61 | namespace QtWayland { |
62 | |
63 | class XdgToplevelV6Integration : public QWaylandQuickShellIntegration |
64 | { |
65 | Q_OBJECT |
66 | public: |
67 | XdgToplevelV6Integration(QWaylandQuickShellSurfaceItem *item); |
68 | |
69 | protected: |
70 | bool eventFilter(QObject *object, QEvent *event) override; |
71 | |
72 | private Q_SLOTS: |
73 | void handleStartMove(QWaylandSeat *seat); |
74 | void handleStartResize(QWaylandSeat *seat, Qt::Edges edges); |
75 | void handleSetMaximized(); |
76 | void handleUnsetMaximized(); |
77 | void handleMaximizedChanged(); |
78 | void handleSetFullscreen(); |
79 | void handleUnsetFullscreen(); |
80 | void handleFullscreenChanged(); |
81 | void handleActivatedChanged(); |
82 | void handleSurfaceSizeChanged(); |
83 | void handleToplevelDestroyed(); |
84 | void handleMaximizedSizeChanged(); |
85 | void handleFullscreenSizeChanged(); |
86 | |
87 | private: |
88 | QWaylandQuickShellSurfaceItem *m_item = nullptr; |
89 | QWaylandXdgSurfaceV6 *m_xdgSurface = nullptr; |
90 | QWaylandXdgToplevelV6 *m_toplevel = nullptr; |
91 | |
92 | enum class GrabberState { |
93 | Default, |
94 | Resize, |
95 | Move |
96 | }; |
97 | GrabberState grabberState; |
98 | |
99 | struct { |
100 | QWaylandSeat *seat = nullptr; |
101 | QPointF initialOffset; |
102 | bool initialized = false; |
103 | } moveState; |
104 | |
105 | struct { |
106 | QWaylandSeat *seat = nullptr; |
107 | Qt::Edges resizeEdges; |
108 | QSizeF initialWindowSize; |
109 | QPointF initialMousePos; |
110 | QPointF initialPosition; |
111 | QSize initialSurfaceSize; |
112 | bool initialized = false; |
113 | } resizeState; |
114 | |
115 | struct { |
116 | QSize initialWindowSize; |
117 | QPointF initialPosition; |
118 | } windowedGeometry; |
119 | |
120 | struct { |
121 | QWaylandOutput *output = nullptr; |
122 | QMetaObject::Connection sizeChangedConnection; // Depending on whether maximized or fullscreen, |
123 | // will be hooked to geometry-changed or available- |
124 | // geometry-changed. |
125 | } nonwindowedState; |
126 | |
127 | bool filterMouseMoveEvent(QMouseEvent *event); |
128 | bool filterMouseReleaseEvent(QMouseEvent *event); |
129 | }; |
130 | |
131 | class XdgPopupV6Integration : public QWaylandQuickShellIntegration |
132 | { |
133 | Q_OBJECT |
134 | public: |
135 | XdgPopupV6Integration(QWaylandQuickShellSurfaceItem *item); |
136 | |
137 | private Q_SLOTS: |
138 | void handleGeometryChanged(); |
139 | |
140 | private: |
141 | QWaylandQuickShellSurfaceItem *m_item = nullptr; |
142 | QWaylandXdgSurfaceV6 *m_xdgSurface = nullptr; |
143 | QWaylandXdgPopupV6 *m_popup = nullptr; |
144 | }; |
145 | |
146 | } |
147 | |
148 | #endif // QT_DEPRECATED_SINCE(5, 15) |
149 | |
150 | QT_END_NAMESPACE |
151 | |
152 | #endif // QWAYLANDXDGSHELLV6INTEGRATION_H |
153 | |