1 | // Copyright (C) 2016 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #ifndef QWAYLANDWLSHELLSURFACE_H |
5 | #define QWAYLANDWLSHELLSURFACE_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists purely as an |
12 | // implementation detail. This header file may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | #include <QtCore/QSize> |
19 | |
20 | #include <QtWaylandClient/qtwaylandclientglobal.h> |
21 | #include <QtWaylandClient/private/qwayland-wayland.h> |
22 | #include <QtWaylandClient/private/qwaylandshellsurface_p.h> |
23 | |
24 | QT_BEGIN_NAMESPACE |
25 | |
26 | class QWindow; |
27 | |
28 | namespace QtWaylandClient { |
29 | |
30 | class QWaylandWindow; |
31 | class QWaylandInputDevice; |
32 | class QWaylandExtendedSurface; |
33 | |
34 | class Q_WAYLANDCLIENT_EXPORT QWaylandWlShellSurface : public QWaylandShellSurface |
35 | , public QtWayland::wl_shell_surface |
36 | { |
37 | Q_OBJECT |
38 | public: |
39 | QWaylandWlShellSurface(struct ::wl_shell_surface *shell_surface, QWaylandWindow *window); |
40 | ~QWaylandWlShellSurface() override; |
41 | |
42 | using QtWayland::wl_shell_surface::resize; |
43 | bool resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override; |
44 | |
45 | using QtWayland::wl_shell_surface::move; |
46 | bool move(QWaylandInputDevice *inputDevice) override; |
47 | |
48 | void setTitle(const QString & title) override; |
49 | void setAppId(const QString &appId) override; |
50 | |
51 | void raise() override; |
52 | void lower() override; |
53 | void setContentOrientationMask(Qt::ScreenOrientations orientation) override; |
54 | void setWindowFlags(Qt::WindowFlags flags) override; |
55 | void sendProperty(const QString &name, const QVariant &value) override; |
56 | |
57 | void applyConfigure() override; |
58 | bool wantsDecorations() const override; |
59 | |
60 | std::any surfaceRole() const override { return object(); }; |
61 | |
62 | protected: |
63 | void requestWindowStates(Qt::WindowStates states) override; |
64 | |
65 | private: |
66 | static enum resize convertToResizeEdges(Qt::Edges edges); |
67 | void setTopLevel(); |
68 | void updateTransientParent(QWindow *parent); |
69 | void setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, uint serial); |
70 | |
71 | QWaylandWindow *m_window = nullptr; |
72 | struct { |
73 | Qt::WindowStates states = Qt::WindowNoState; |
74 | QSize size; |
75 | enum resize edges = resize_none; |
76 | } m_applied, m_pending; |
77 | QSize m_normalSize; |
78 | // There's really no need to have pending and applied state on wl-shell, but we do it just to |
79 | // keep the different shell implementations more similar. |
80 | QWaylandExtendedSurface *m_extendedWindow = nullptr; |
81 | |
82 | void shell_surface_ping(uint32_t serial) override; |
83 | void shell_surface_configure(uint32_t edges, |
84 | int32_t width, |
85 | int32_t height) override; |
86 | void shell_surface_popup_done() override; |
87 | |
88 | friend class QWaylandWindow; |
89 | }; |
90 | |
91 | QT_END_NAMESPACE |
92 | |
93 | } |
94 | |
95 | #endif // QWAYLANDSHELLSURFACE_H |
96 | |