Warning: That file was not part of the compilation database. It may have many parsing errors.
| 1 | /**************************************************************************** |
|---|---|
| 2 | ** |
| 3 | ** Copyright (C) 2018 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 QWAYLANDXDGSHELL_H |
| 31 | #define QWAYLANDXDGSHELL_H |
| 32 | |
| 33 | #include <QtWaylandCompositor/QWaylandCompositorExtension> |
| 34 | #include <QtWaylandCompositor/QWaylandResource> |
| 35 | #include <QtWaylandCompositor/QWaylandShell> |
| 36 | #include <QtWaylandCompositor/QWaylandShellSurface> |
| 37 | #include <QtWaylandCompositor/qwaylandquickchildren.h> |
| 38 | |
| 39 | #include <QtCore/QRect> |
| 40 | |
| 41 | struct wl_resource; |
| 42 | |
| 43 | QT_BEGIN_NAMESPACE |
| 44 | |
| 45 | class QWaylandClient; |
| 46 | class QWaylandOutput; |
| 47 | class QWaylandSeat; |
| 48 | class QWaylandSurface; |
| 49 | class QWaylandSurfaceRole; |
| 50 | class QWaylandXdgShellPrivate; |
| 51 | class QWaylandXdgSurface; |
| 52 | class QWaylandXdgSurfacePrivate; |
| 53 | class QWaylandXdgToplevel; |
| 54 | class QWaylandXdgToplevelPrivate; |
| 55 | class QWaylandXdgPopup; |
| 56 | class QWaylandXdgPopupPrivate; |
| 57 | class QWaylandXdgPositioner; |
| 58 | |
| 59 | class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgShell : public QWaylandShellTemplate<QWaylandXdgShell> |
| 60 | { |
| 61 | Q_OBJECT |
| 62 | Q_DECLARE_PRIVATE(QWaylandXdgShell) |
| 63 | public: |
| 64 | explicit QWaylandXdgShell(); |
| 65 | explicit QWaylandXdgShell(QWaylandCompositor *compositor); |
| 66 | |
| 67 | void initialize() override; |
| 68 | |
| 69 | static const struct wl_interface *interface(); |
| 70 | static QByteArray interfaceName(); |
| 71 | |
| 72 | public Q_SLOTS: |
| 73 | uint ping(QWaylandClient *client); |
| 74 | |
| 75 | Q_SIGNALS: |
| 76 | void xdgSurfaceCreated(QWaylandXdgSurface *xdgSurface); |
| 77 | void toplevelCreated(QWaylandXdgToplevel *toplevel, QWaylandXdgSurface *xdgSurface); |
| 78 | void popupCreated(QWaylandXdgPopup *popup, QWaylandXdgSurface *xdgSurface); |
| 79 | void pong(uint serial); |
| 80 | |
| 81 | private Q_SLOTS: |
| 82 | void handleSeatChanged(QWaylandSeat *newSeat, QWaylandSeat *oldSeat); |
| 83 | void handleFocusChanged(QWaylandSurface *newSurface, QWaylandSurface *oldSurface); |
| 84 | }; |
| 85 | |
| 86 | class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgSurface : public QWaylandShellSurfaceTemplate<QWaylandXdgSurface> |
| 87 | { |
| 88 | Q_OBJECT |
| 89 | Q_DECLARE_PRIVATE(QWaylandXdgSurface) |
| 90 | Q_WAYLAND_COMPOSITOR_DECLARE_QUICK_CHILDREN(QWaylandXdgSurface) |
| 91 | Q_PROPERTY(QWaylandXdgShell *shell READ shell NOTIFY shellChanged) |
| 92 | Q_PROPERTY(QWaylandSurface *surface READ surface NOTIFY surfaceChanged) |
| 93 | Q_PROPERTY(QWaylandXdgToplevel *toplevel READ toplevel NOTIFY toplevelCreated) |
| 94 | Q_PROPERTY(QWaylandXdgPopup *popup READ popup NOTIFY popupCreated) |
| 95 | Q_PROPERTY(QRect windowGeometry READ windowGeometry NOTIFY windowGeometryChanged) |
| 96 | |
| 97 | public: |
| 98 | explicit QWaylandXdgSurface(); |
| 99 | explicit QWaylandXdgSurface(QWaylandXdgShell* xdgShell, QWaylandSurface *surface, const QWaylandResource &resource); |
| 100 | |
| 101 | Q_INVOKABLE void initialize(QWaylandXdgShell* xdgShell, QWaylandSurface *surface, const QWaylandResource &resource); |
| 102 | |
| 103 | Qt::WindowType windowType() const override; |
| 104 | |
| 105 | QWaylandXdgShell *shell() const; |
| 106 | QWaylandSurface *surface() const; |
| 107 | QWaylandXdgToplevel *toplevel() const; |
| 108 | QWaylandXdgPopup *popup() const; |
| 109 | QRect windowGeometry() const; |
| 110 | |
| 111 | static const struct wl_interface *interface(); |
| 112 | static QByteArray interfaceName(); |
| 113 | static QWaylandXdgSurface *fromResource(::wl_resource *resource); |
| 114 | |
| 115 | #if QT_CONFIG(wayland_compositor_quick) |
| 116 | QWaylandQuickShellIntegration *createIntegration(QWaylandQuickShellSurfaceItem *item) override; |
| 117 | #endif |
| 118 | |
| 119 | Q_SIGNALS: |
| 120 | void shellChanged(); |
| 121 | void surfaceChanged(); |
| 122 | void toplevelCreated(); |
| 123 | void popupCreated(); |
| 124 | void windowGeometryChanged(); |
| 125 | |
| 126 | private: |
| 127 | void initialize() override; |
| 128 | |
| 129 | private Q_SLOTS: |
| 130 | void handleSurfaceSizeChanged(); |
| 131 | void handleBufferScaleChanged(); |
| 132 | }; |
| 133 | |
| 134 | class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgToplevel : public QObject |
| 135 | { |
| 136 | Q_OBJECT |
| 137 | Q_DECLARE_PRIVATE(QWaylandXdgToplevel) |
| 138 | Q_PROPERTY(QWaylandXdgSurface *xdgSurface READ xdgSurface CONSTANT) |
| 139 | Q_PROPERTY(QWaylandXdgToplevel *parentToplevel READ parentToplevel NOTIFY parentToplevelChanged) |
| 140 | Q_PROPERTY(QString title READ title NOTIFY titleChanged) |
| 141 | Q_PROPERTY(QString appId READ appId NOTIFY appIdChanged) |
| 142 | Q_PROPERTY(QSize maxSize READ maxSize NOTIFY maxSizeChanged) |
| 143 | Q_PROPERTY(QSize minSize READ minSize NOTIFY minSizeChanged) |
| 144 | Q_PROPERTY(QList<int> states READ statesAsInts NOTIFY statesChanged) |
| 145 | Q_PROPERTY(bool maximized READ maximized NOTIFY maximizedChanged) |
| 146 | Q_PROPERTY(bool fullscreen READ fullscreen NOTIFY fullscreenChanged) |
| 147 | Q_PROPERTY(bool resizing READ resizing NOTIFY resizingChanged) |
| 148 | Q_PROPERTY(bool activated READ activated NOTIFY activatedChanged) |
| 149 | // QDoc fails to parse the property type that includes the keyword 'enum' |
| 150 | #ifndef Q_CLANG_QDOC |
| 151 | Q_PROPERTY(enum DecorationMode decorationMode READ decorationMode NOTIFY decorationModeChanged) |
| 152 | #else |
| 153 | Q_PROPERTY(DecorationMode decorationMode READ decorationMode NOTIFY decorationModeChanged) |
| 154 | #endif |
| 155 | public: |
| 156 | enum State : uint { |
| 157 | MaximizedState = 1, |
| 158 | FullscreenState = 2, |
| 159 | ResizingState = 3, |
| 160 | ActivatedState = 4 |
| 161 | }; |
| 162 | Q_ENUM(State) |
| 163 | |
| 164 | enum DecorationMode { |
| 165 | ClientSideDecoration = 1, |
| 166 | ServerSideDecoration = 2, |
| 167 | }; |
| 168 | Q_ENUM(DecorationMode) |
| 169 | |
| 170 | explicit QWaylandXdgToplevel(QWaylandXdgSurface *xdgSurface, QWaylandResource &resource); |
| 171 | ~QWaylandXdgToplevel() override; |
| 172 | |
| 173 | QWaylandXdgSurface *xdgSurface() const; |
| 174 | QWaylandXdgToplevel *parentToplevel() const; |
| 175 | |
| 176 | QString title() const; |
| 177 | QString appId() const; |
| 178 | QSize maxSize() const; |
| 179 | QSize minSize() const; |
| 180 | QVector<QWaylandXdgToplevel::State> states() const; |
| 181 | bool maximized() const; |
| 182 | bool fullscreen() const; |
| 183 | bool resizing() const; |
| 184 | bool activated() const; |
| 185 | DecorationMode decorationMode() const; |
| 186 | |
| 187 | Q_INVOKABLE QSize sizeForResize(const QSizeF &size, const QPointF &delta, Qt::Edges edges) const; |
| 188 | uint sendConfigure(const QSize &size, const QVector<State> &states); |
| 189 | Q_INVOKABLE uint sendConfigure(const QSize &size, const QVector<int> &states); |
| 190 | Q_INVOKABLE void sendClose(); |
| 191 | Q_INVOKABLE uint sendMaximized(const QSize &size); |
| 192 | Q_INVOKABLE uint sendUnmaximized(const QSize &size = QSize(0, 0)); |
| 193 | Q_INVOKABLE uint sendFullscreen(const QSize &size); |
| 194 | Q_INVOKABLE uint sendResizing(const QSize &maxSize); |
| 195 | |
| 196 | static QWaylandSurfaceRole *role(); |
| 197 | static QWaylandXdgToplevel *fromResource(::wl_resource *resource); |
| 198 | |
| 199 | Q_SIGNALS: |
| 200 | void parentToplevelChanged(); |
| 201 | void titleChanged(); |
| 202 | void appIdChanged(); |
| 203 | void maxSizeChanged(); |
| 204 | void minSizeChanged(); |
| 205 | void startMove(QWaylandSeat *seat); |
| 206 | void startResize(QWaylandSeat *seat, Qt::Edges edges); |
| 207 | void statesChanged(); |
| 208 | void maximizedChanged(); |
| 209 | void fullscreenChanged(); |
| 210 | void resizingChanged(); |
| 211 | void activatedChanged(); |
| 212 | |
| 213 | void showWindowMenu(QWaylandSeat *seat, const QPoint &localSurfacePosition); |
| 214 | void setMaximized(); |
| 215 | void unsetMaximized(); |
| 216 | void setFullscreen(QWaylandOutput *output); |
| 217 | void unsetFullscreen(); |
| 218 | void setMinimized(); |
| 219 | |
| 220 | void decorationModeChanged(); |
| 221 | |
| 222 | private: |
| 223 | QList<int> statesAsInts() const; |
| 224 | }; |
| 225 | |
| 226 | class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgPopup : public QObject |
| 227 | { |
| 228 | Q_OBJECT |
| 229 | Q_DECLARE_PRIVATE(QWaylandXdgPopup) |
| 230 | Q_PROPERTY(QWaylandXdgSurface *xdgSurface READ xdgSurface CONSTANT) |
| 231 | Q_PROPERTY(QWaylandXdgSurface *parentXdgSurface READ parentXdgSurface CONSTANT) |
| 232 | Q_PROPERTY(QRect configuredGeometry READ configuredGeometry NOTIFY configuredGeometryChanged) |
| 233 | |
| 234 | // Positioner properties |
| 235 | Q_PROPERTY(QRect anchorRect READ anchorRect CONSTANT) |
| 236 | Q_PROPERTY(Qt::Edges anchorEdges READ anchorEdges CONSTANT) |
| 237 | Q_PROPERTY(Qt::Edges gravityEdges READ gravityEdges CONSTANT) |
| 238 | Q_PROPERTY(Qt::Orientations slideConstraints READ slideConstraints CONSTANT) |
| 239 | Q_PROPERTY(Qt::Orientations flipConstraints READ flipConstraints CONSTANT) |
| 240 | Q_PROPERTY(Qt::Orientations resizeConstraints READ resizeConstraints CONSTANT) |
| 241 | Q_PROPERTY(QPoint offset READ offset CONSTANT) |
| 242 | Q_PROPERTY(QSize positionerSize READ positionerSize CONSTANT) |
| 243 | Q_PROPERTY(QPoint unconstrainedPosition READ unconstrainedPosition CONSTANT) |
| 244 | public: |
| 245 | QWaylandXdgSurface *xdgSurface() const; |
| 246 | QWaylandXdgSurface *parentXdgSurface() const; |
| 247 | QRect configuredGeometry() const; |
| 248 | |
| 249 | // Positioner properties |
| 250 | QRect anchorRect() const; |
| 251 | Qt::Edges anchorEdges() const ; |
| 252 | Qt::Edges gravityEdges() const ; |
| 253 | Qt::Orientations slideConstraints() const; |
| 254 | Qt::Orientations flipConstraints() const; |
| 255 | Qt::Orientations resizeConstraints() const; |
| 256 | QPoint offset() const; |
| 257 | QSize positionerSize() const; |
| 258 | QPoint unconstrainedPosition() const; |
| 259 | |
| 260 | Q_INVOKABLE uint sendConfigure(const QRect &geometry); |
| 261 | Q_REVISION(14) Q_INVOKABLE void sendPopupDone(); |
| 262 | |
| 263 | static QWaylandSurfaceRole *role(); |
| 264 | |
| 265 | Q_SIGNALS: |
| 266 | void configuredGeometryChanged(); |
| 267 | |
| 268 | private: |
| 269 | explicit QWaylandXdgPopup(QWaylandXdgSurface *xdgSurface, QWaylandXdgSurface *parentXdgSurface, |
| 270 | QWaylandXdgPositioner *positioner, QWaylandResource &resource); |
| 271 | friend class QWaylandXdgSurfacePrivate; |
| 272 | }; |
| 273 | |
| 274 | QT_END_NAMESPACE |
| 275 | |
| 276 | #endif // QWAYLANDXDGSHELL_H |
| 277 |
Warning: That file was not part of the compilation database. It may have many parsing errors.
