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 QWAYLANDSHELLSURFACE_H |
5 | #define QWAYLANDSHELLSURFACE_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 | #include <QObject> |
20 | #include <QPoint> |
21 | #include <QtWaylandClient/qtwaylandclientglobal.h> |
22 | #include <QtCore/private/qglobal_p.h> |
23 | |
24 | #include <any> |
25 | |
26 | struct wl_surface; |
27 | |
28 | QT_BEGIN_NAMESPACE |
29 | |
30 | class QVariant; |
31 | class QWindow; |
32 | class QPlatformWindow; |
33 | |
34 | namespace QtWaylandClient { |
35 | |
36 | class QWaylandWindow; |
37 | class QWaylandInputDevice; |
38 | |
39 | class Q_WAYLANDCLIENT_EXPORT QWaylandShellSurface : public QObject |
40 | { |
41 | Q_OBJECT |
42 | public: |
43 | explicit QWaylandShellSurface(QWaylandWindow *window); |
44 | ~QWaylandShellSurface() override {} |
45 | virtual bool resize(QWaylandInputDevice *, Qt::Edges) { return false; } |
46 | virtual bool move(QWaylandInputDevice *) { return false; } |
47 | virtual bool showWindowMenu(QWaylandInputDevice *seat) { Q_UNUSED(seat); return false; } |
48 | virtual void setTitle(const QString & /*title*/) {} |
49 | virtual void setAppId(const QString & /*appId*/) {} |
50 | |
51 | virtual void setWindowFlags(Qt::WindowFlags flags); |
52 | |
53 | virtual bool isExposed() const { return true; } |
54 | virtual bool handleExpose(const QRegion &) { return false; } |
55 | |
56 | virtual void raise() {} |
57 | virtual void lower() {} |
58 | virtual void setContentOrientationMask(Qt::ScreenOrientations orientation) { Q_UNUSED(orientation); } |
59 | |
60 | virtual void sendProperty(const QString &name, const QVariant &value); |
61 | |
62 | virtual void applyConfigure() {} |
63 | virtual void requestWindowStates(Qt::WindowStates states) {Q_UNUSED(states);} |
64 | virtual bool wantsDecorations() const { return false; } |
65 | virtual QMargins serverSideFrameMargins() const { return QMargins(); } |
66 | |
67 | virtual void propagateSizeHints() {} |
68 | |
69 | virtual void setWindowGeometry(const QRect &rect) { Q_UNUSED(rect); } |
70 | virtual void setWindowPosition(const QPoint &position) { Q_UNUSED(position); } |
71 | |
72 | virtual bool requestActivate() { return false; } |
73 | virtual bool requestActivateOnShow() { return false; } |
74 | virtual void setXdgActivationToken(const QString &token); |
75 | virtual void requestXdgActivationToken(quint32 serial); |
76 | |
77 | virtual void setAlertState(bool enabled) { Q_UNUSED(enabled); } |
78 | virtual bool isAlertState() const { return false; } |
79 | |
80 | virtual QString externWindowHandle() { return QString(); } |
81 | |
82 | inline QWaylandWindow *window() { return m_window; } |
83 | QPlatformWindow *platformWindow(); |
84 | struct wl_surface *wlSurface(); |
85 | |
86 | virtual std::any surfaceRole() const { return std::any(); }; |
87 | |
88 | virtual void attachPopup(QWaylandShellSurface *popup) { Q_UNUSED(popup); } |
89 | virtual void detachPopup(QWaylandShellSurface *popup) { Q_UNUSED(popup); } |
90 | |
91 | protected: |
92 | void resizeFromApplyConfigure(const QSize &sizeWithMargins, const QPoint &offset = {0, 0}); |
93 | void repositionFromApplyConfigure(const QPoint &position); |
94 | void setGeometryFromApplyConfigure(const QPoint &globalPosition, const QSize &sizeWithMargins); |
95 | void applyConfigureWhenPossible(); |
96 | void handleActivationChanged(bool activated); |
97 | |
98 | static uint32_t getSerial(QWaylandInputDevice *inputDevice); |
99 | |
100 | private: |
101 | QWaylandWindow *m_window = nullptr; |
102 | friend class QWaylandWindow; |
103 | }; |
104 | |
105 | } |
106 | |
107 | QT_END_NAMESPACE |
108 | |
109 | #endif // QWAYLANDSHELLSURFACE_H |
110 |
Definitions
- QWaylandShellSurface
- ~QWaylandShellSurface
- resize
- move
- showWindowMenu
- setTitle
- setAppId
- isExposed
- handleExpose
- raise
- lower
- setContentOrientationMask
- applyConfigure
- requestWindowStates
- wantsDecorations
- serverSideFrameMargins
- propagateSizeHints
- setWindowGeometry
- setWindowPosition
- requestActivate
- requestActivateOnShow
- setAlertState
- isAlertState
- externWindowHandle
- window
- surfaceRole
- attachPopup
Learn Advanced QML with KDAB
Find out more