1 | // Copyright (C) 2021 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 QWAYLANDQTSURFACE_H |
5 | #define QWAYLANDQTSURFACE_H |
6 | |
7 | #include <QtCore/qpoint.h> |
8 | #include <QtWaylandClient/private/qwaylandshellsurface_p.h> |
9 | #include "qwayland-qt-shell-unstable-v1.h" |
10 | |
11 | QT_BEGIN_NAMESPACE |
12 | |
13 | namespace QtWaylandClient { |
14 | |
15 | class QWaylandWindow; |
16 | class QWaylandInputDevice; |
17 | |
18 | class Q_WAYLANDCLIENT_EXPORT QWaylandQtSurface : public QWaylandShellSurface |
19 | , public QtWayland::zqt_shell_surface_v1 |
20 | { |
21 | public: |
22 | QWaylandQtSurface(struct ::zqt_shell_surface_v1 *shell_surface, QWaylandWindow *window); |
23 | ~QWaylandQtSurface() override; |
24 | |
25 | void applyConfigure() override; |
26 | void setWindowGeometry(const QRect &rect) override; |
27 | void setWindowPosition(const QPoint &position) override; |
28 | |
29 | void setWindowFlags(Qt::WindowFlags flags) override; |
30 | void requestWindowStates(Qt::WindowStates states) override; |
31 | void setTitle(const QString &title) override; |
32 | |
33 | bool resize(QWaylandInputDevice *, Qt::Edges) override; |
34 | bool move(QWaylandInputDevice *) override; |
35 | bool requestActivate() override; |
36 | |
37 | void propagateSizeHints() override; |
38 | |
39 | QMargins serverSideFrameMargins() const override; |
40 | |
41 | void raise() override; |
42 | void lower() override; |
43 | |
44 | std::any surfaceRole() const override { return object(); }; |
45 | |
46 | private: |
47 | void resetConfiguration(); |
48 | void sendSizeHints(); |
49 | void zqt_shell_surface_v1_close() override; |
50 | void zqt_shell_surface_v1_resize(uint32_t serial, int32_t width, int32_t height) override; |
51 | void zqt_shell_surface_v1_set_position(uint32_t serial, int32_t x, int32_t y) override; |
52 | void zqt_shell_surface_v1_configure(uint32_t serial) override; |
53 | void zqt_shell_surface_v1_set_window_state(uint32_t serial, uint32_t state) override; |
54 | void zqt_shell_surface_v1_set_frame_margins(uint32_t left, uint32_t right, |
55 | uint32_t top, uint32_t bottom) override; |
56 | void zqt_shell_surface_v1_set_capabilities(uint32_t capabilities) override; |
57 | |
58 | QSize m_pendingSize; |
59 | QPoint m_pendingPosition = { -1, -1 }; |
60 | bool m_pendingPositionValid = false; |
61 | Qt::WindowStates m_pendingStates = Qt::WindowNoState; |
62 | Qt::WindowStates m_currentStates = Qt::WindowNoState; |
63 | QMargins m_frameMargins; |
64 | uint32_t m_currentConfigureSerial = UINT32_MAX; |
65 | uint32_t m_capabilities = 0; |
66 | }; |
67 | |
68 | } |
69 | |
70 | QT_END_NAMESPACE |
71 | |
72 | #endif // QWAYLANDQTSURFACE_H |
73 | |