Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qwaylandsurface.h
Go to the documentation of this file.
1// Copyright (C) 2017-2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
2// Copyright (C) 2017 The Qt Company Ltd.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
4// Qt-Security score:significant reason:default
5
6#ifndef QWAYLANDSURFACE_H
7#define QWAYLANDSURFACE_H
8
9#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
10#include <QtWaylandCompositor/qwaylandcompositor.h>
11#include <QtWaylandCompositor/qwaylandcompositorextension.h>
12#include <QtWaylandCompositor/qwaylandclient.h>
13#include <QtWaylandCompositor/qwaylanddrag.h>
14
15#include <QtCore/QScopedPointer>
16#include <QtGui/QImage>
17#include <QtGui/QWindow>
18#include <QtCore/QVariantMap>
19
20struct wl_client;
21struct wl_resource;
22
23QT_BEGIN_NAMESPACE
24
25class QTouchEvent;
26class QWaylandSurfacePrivate;
27class QWaylandBufferRef;
28class QWaylandView;
30
32{
33public:
34 QWaylandSurfaceRole(const QByteArray &n) : m_name(n) {}
35
36 const QByteArray name() { return m_name; }
37
38private:
39 QByteArray m_name;
40};
41
42class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandSurface : public QWaylandObject
43{
44 Q_OBJECT
45 Q_DECLARE_PRIVATE(QWaylandSurface)
46 Q_PROPERTY(QWaylandClient *client READ client CONSTANT)
47 Q_PROPERTY(QRectF sourceGeometry READ sourceGeometry NOTIFY sourceGeometryChanged REVISION(1, 13))
48 Q_PROPERTY(QSize destinationSize READ destinationSize NOTIFY destinationSizeChanged REVISION(1, 13))
49 Q_PROPERTY(QSize bufferSize READ bufferSize NOTIFY bufferSizeChanged REVISION(1, 13))
50 Q_PROPERTY(int bufferScale READ bufferScale NOTIFY bufferScaleChanged)
51 Q_PROPERTY(Qt::ScreenOrientation contentOrientation READ contentOrientation NOTIFY contentOrientationChanged)
52 Q_PROPERTY(QWaylandSurface::Origin origin READ origin NOTIFY originChanged)
53 Q_PROPERTY(bool hasContent READ hasContent NOTIFY hasContentChanged)
54 Q_PROPERTY(bool cursorSurface READ isCursorSurface WRITE markAsCursorSurface NOTIFY cursorSurfaceChanged)
55 Q_PROPERTY(bool inhibitsIdle READ inhibitsIdle NOTIFY inhibitsIdleChanged REVISION(1, 14))
56 Q_PROPERTY(bool isOpaque READ isOpaque NOTIFY isOpaqueChanged REVISION(6, 4))
57 Q_MOC_INCLUDE("qwaylanddrag.h")
58 Q_MOC_INCLUDE("qwaylandcompositor.h")
59
60 QML_NAMED_ELEMENT(WaylandSurfaceBase)
61 QML_ADDED_IN_VERSION(1, 0)
62 QML_UNCREATABLE("Cannot create instance of WaylandSurfaceBase, use WaylandSurface instead")
63public:
64 enum Origin {
65 OriginTopLeft,
66 OriginBottomLeft
67 };
68 Q_ENUM(Origin)
69
70 QWaylandSurface();
71 QWaylandSurface(QWaylandCompositor *compositor, QWaylandClient *client, uint id, int version);
72 ~QWaylandSurface() override;
73
74 Q_INVOKABLE void initialize(QWaylandCompositor *compositor, QWaylandClient *client, uint id, int version);
75 bool isInitialized() const;
76
77 QWaylandClient *client() const;
78 ::wl_client *waylandClient() const;
79
80 bool setRole(QWaylandSurfaceRole *role, wl_resource *errorResource, uint32_t errorCode);
81 QWaylandSurfaceRole *role() const;
82
83 bool hasContent() const;
84
85 QRectF sourceGeometry() const;
86 QSize destinationSize() const;
87 QSize bufferSize() const;
88 int bufferScale() const;
89
90 Qt::ScreenOrientation contentOrientation() const;
91
92 Origin origin() const;
93
94 QWaylandCompositor *compositor() const;
95
96 bool inputRegionContains(const QPoint &p) const;
97 bool inputRegionContains(const QPointF &position) const;
98
99 Q_INVOKABLE void destroy();
100 Q_INVOKABLE bool isDestroyed() const;
101
102 Q_INVOKABLE void frameStarted();
103 Q_INVOKABLE void sendFrameCallbacks();
104
105 QWaylandView *primaryView() const;
106 void setPrimaryView(QWaylandView *view);
107
108 QList<QWaylandView *> views() const;
109
110 static QWaylandSurface *fromResource(::wl_resource *resource);
111 struct wl_resource *resource() const;
112
113 void markAsCursorSurface(bool cursorSurface);
114 bool isCursorSurface() const;
115
116 bool inhibitsIdle() const;
117 bool isOpaque() const;
118
119#if QT_CONFIG(im)
120 QWaylandInputMethodControl *inputMethodControl() const;
121#endif
122
123public Q_SLOTS:
124#if QT_CONFIG(clipboard)
125 void updateSelection();
126#endif
127
128protected:
129 QWaylandSurface(QWaylandSurfacePrivate &dptr);
130
131Q_SIGNALS:
132 void hasContentChanged();
133 void damaged(const QRegion &rect);
134 void parentChanged(QWaylandSurface *newParent, QWaylandSurface *oldParent);
135 void childAdded(QWaylandSurface *child);
136 Q_REVISION(1, 13) void sourceGeometryChanged();
137 Q_REVISION(1, 13) void destinationSizeChanged();
138 Q_REVISION(1, 13) void bufferSizeChanged();
139 void bufferScaleChanged();
140 void offsetForNextFrame(const QPoint &offset);
141 void contentOrientationChanged();
142 void surfaceDestroyed();
143 void originChanged();
144 void subsurfacePositionChanged(const QPoint &position);
145 void subsurfacePlaceAbove(QWaylandSurface *sibling);
146 void subsurfacePlaceBelow(QWaylandSurface *sibling);
147 void dragStarted(QWaylandDrag *drag);
148 void cursorSurfaceChanged();
149 Q_REVISION(14) void inhibitsIdleChanged();
150 Q_REVISION(6, 4) void isOpaqueChanged();
151
152 void configure(bool hasBuffer);
153 void redraw();
154};
155
156QT_END_NAMESPACE
157
158#endif // QWAYLANDSURFACE_H
\inmodule QtWaylandCompositor
QWaylandSurfaceRole(const QByteArray &n)
Creates a QWaylandSurfaceRole and assigns it name.
const QByteArray name()
Returns the name of the QWaylandSurfaceRole.
\qmltype WaylandSurface \nativetype QWaylandSurface \inqmlmodule QtWayland.Compositor
FrameCallback(QWaylandSurface *surf, wl_resource *res)
static void destroyCallback(wl_resource *res)
Combined button and popup list for selecting options.
static QRegion infiniteRegion()