Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qwaylandcompositor.h
Go to the documentation of this file.
1// Copyright (C) 2020 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QWAYLANDCOMPOSITOR_H
5#define QWAYLANDCOMPOSITOR_H
6
7#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
8#include <QtWaylandCompositor/qtwaylandqmlinclude.h>
9#include <QtWaylandCompositor/qwaylandcompositorextension.h>
10#include <QtWaylandCompositor/QWaylandOutput>
11
12#include <QtCore/QObject>
13#include <QtGui/QImage>
14#include <QtCore/QRect>
15#include <QtCore/QLoggingCategory>
16
17struct wl_display;
18
20
21class QInputEvent;
22
23class QMimeData;
24class QUrl;
25class QOpenGLContext;
27class QWaylandClient;
28class QWaylandSurface;
29class QWaylandSeat;
30class QWaylandView;
31class QWaylandPointer;
33class QWaylandTouch;
36
37Q_WAYLANDCOMPOSITOR_EXPORT Q_DECLARE_LOGGING_CATEGORY(qLcWaylandCompositor)
38Q_WAYLANDCOMPOSITOR_EXPORT Q_DECLARE_LOGGING_CATEGORY(qLcWaylandCompositorHardwareIntegration)
39Q_DECLARE_LOGGING_CATEGORY(qLcWaylandCompositorInputMethods)
40Q_DECLARE_LOGGING_CATEGORY(qLcWaylandCompositorTextInput)
41
42class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandCompositor : public QWaylandObject
43{
45 Q_DECLARE_PRIVATE(QWaylandCompositor)
46 Q_PROPERTY(QByteArray socketName READ socketName WRITE setSocketName NOTIFY socketNameChanged)
47 Q_PROPERTY(bool created READ isCreated NOTIFY createdChanged)
48 Q_PROPERTY(bool retainedSelection READ retainedSelectionEnabled WRITE setRetainedSelectionEnabled NOTIFY retainedSelectionChanged)
49 Q_PROPERTY(QWaylandOutput *defaultOutput READ defaultOutput WRITE setDefaultOutput NOTIFY defaultOutputChanged)
50 Q_PROPERTY(bool useHardwareIntegrationExtension READ useHardwareIntegrationExtension WRITE setUseHardwareIntegrationExtension NOTIFY useHardwareIntegrationExtensionChanged)
51 Q_PROPERTY(QWaylandSeat *defaultSeat READ defaultSeat NOTIFY defaultSeatChanged)
52 Q_PROPERTY(QVector<ShmFormat> additionalShmFormats READ additionalShmFormats WRITE setAdditionalShmFormats NOTIFY additionalShmFormatsChanged REVISION(6, 0))
53 Q_MOC_INCLUDE("qwaylandseat.h")
54 QML_NAMED_ELEMENT(WaylandCompositorBase)
55 QML_UNCREATABLE("Cannot create instance of WaylandCompositorBase, use WaylandCompositor instead")
57public:
58 // Duplicates subset of supported values wl_shm_format enum
59 enum ShmFormat {
60 ShmFormat_ARGB8888 = 0,
61 ShmFormat_XRGB8888 = 1,
62 ShmFormat_C8 = 0x20203843,
63 ShmFormat_XRGB4444 = 0x32315258,
64 ShmFormat_ARGB4444 = 0x32315241,
65 ShmFormat_XRGB1555 = 0x35315258,
66 ShmFormat_RGB565 = 0x36314752,
67 ShmFormat_RGB888 = 0x34324752,
68 ShmFormat_XBGR8888 = 0x34324258,
69 ShmFormat_ABGR8888 = 0x34324241,
70 ShmFormat_BGR888 = 0x34324742,
71 ShmFormat_XRGB2101010 = 0x30335258,
72 ShmFormat_XBGR2101010 = 0x30334258,
73 ShmFormat_ARGB2101010 = 0x30335241,
74 ShmFormat_ABGR2101010 = 0x30334241
75 };
76 Q_ENUM(ShmFormat)
77
78 QWaylandCompositor(QObject *parent = nullptr);
79 ~QWaylandCompositor() override;
80
81 virtual void create();
82 bool isCreated() const;
83
84 void setSocketName(const QByteArray &name);
85 QByteArray socketName() const;
86
87 Q_INVOKABLE void addSocketDescriptor(int fd);
88
89 ::wl_display *display() const;
90 uint32_t nextSerial();
91
92 QList<QWaylandClient *>clients() const;
93 Q_INVOKABLE void destroyClientForSurface(QWaylandSurface *surface);
94 Q_INVOKABLE void destroyClient(QWaylandClient *client);
95
96 QList<QWaylandSurface *> surfaces() const;
97 QList<QWaylandSurface *> surfacesForClient(QWaylandClient* client) const;
98
99 Q_INVOKABLE QWaylandOutput *outputFor(QWindow *window) const;
100
101 QWaylandOutput *defaultOutput() const;
102 void setDefaultOutput(QWaylandOutput *output);
103 QList<QWaylandOutput *> outputs() const;
104
105 uint currentTimeMsecs() const;
106
107 void setRetainedSelectionEnabled(bool enabled);
108 bool retainedSelectionEnabled() const;
109 void overrideSelection(const QMimeData *data);
110
111 QWaylandSeat *defaultSeat() const;
112
113 QWaylandSeat *seatFor(QInputEvent *inputEvent);
114
115 bool useHardwareIntegrationExtension() const;
116 void setUseHardwareIntegrationExtension(bool use);
117
118 QVector<ShmFormat> additionalShmFormats() const;
119 void setAdditionalShmFormats(const QVector<ShmFormat> &additionalShmFormats);
120
121 virtual void grabSurface(QWaylandSurfaceGrabber *grabber, const QWaylandBufferRef &buffer);
122
123public Q_SLOTS:
124 void processWaylandEvents();
125
126private Q_SLOTS:
127 void applicationStateChanged(Qt::ApplicationState state);
128
130 void createdChanged();
131 void socketNameChanged(const QByteArray &socketName);
132 void retainedSelectionChanged(bool retainedSelection);
133
134 void surfaceRequested(QWaylandClient *client, uint id, int version);
135 void surfaceCreated(QWaylandSurface *surface);
136 void surfaceAboutToBeDestroyed(QWaylandSurface *surface);
137 void subsurfaceChanged(QWaylandSurface *child, QWaylandSurface *parent);
138
139 void defaultOutputChanged();
140 void defaultSeatChanged(QWaylandSeat *newDevice, QWaylandSeat *oldDevice);
141
142 void useHardwareIntegrationExtensionChanged();
143
144 void outputAdded(QWaylandOutput *output);
145 void outputRemoved(QWaylandOutput *output);
146
147 void additionalShmFormatsChanged();
148
149protected:
150 virtual void retainedSelectionReceived(QMimeData *mimeData);
151 virtual QWaylandSeat *createSeat();
152 virtual QWaylandPointer *createPointerDevice(QWaylandSeat *seat);
153 virtual QWaylandKeyboard *createKeyboardDevice(QWaylandSeat *seat);
155
156 QWaylandCompositor(QWaylandCompositorPrivate &dptr, QObject *parent = nullptr);
157};
158
160
161#endif // QWAYLANDCOMPOSITOR_H
\inmodule QtCore
Definition qbytearray.h:57
\inmodule QtGui
Definition qevent.h:49
\inmodule QtCore
Definition qmimedata.h:16
\inmodule QtCore
Definition qobject.h:103
\inmodule QtGui
\inmodule QtCore
Definition qurl.h:94
\inmodule QtWaylandCompositor
\qmltype WaylandClient \instantiates QWaylandClient \inqmlmodule QtWayland.Compositor
\qmltype WaylandCompositor \instantiates QWaylandCompositor \inqmlmodule QtWayland....
\inmodule QtWaylandCompositor
\inmodule QtWaylandCompositor
\qmltype WaylandOutput \instantiates QWaylandOutput \inqmlmodule QtWayland.Compositor
\inmodule QtWaylandCompositor
\qmltype WaylandSeat \instantiates QWaylandSeat \inqmlmodule QtWayland.Compositor
\inmodule QtWaylandCompositor
\qmltype WaylandSurface \instantiates QWaylandSurface \inqmlmodule QtWayland.Compositor
\inmodule QtWaylandCompositor
\qmltype WaylandView \instantiates QWaylandView \inqmlmodule QtWayland.Compositor
\inmodule QtGui
Definition qwindow.h:63
else opt state
[0]
struct wl_display * display
Definition linuxdmabuf.h:41
Combined button and popup list for selecting options.
Q_GUI_EXPORT QPointingDevice * createTouchDevice(QInputDevice::DeviceType devType=QInputDevice::DeviceType::TouchScreen, QInputDevice::Capabilities caps=QInputDevice::Capability::Position)
ApplicationState
Definition qnamespace.h:262
#define Q_DECLARE_LOGGING_CATEGORY(name)
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLenum GLuint buffer
GLuint64 GLenum GLint fd
GLuint name
GLfloat GLfloat GLfloat GLfloat h
const GLvdpauSurfaceNV * surfaces
#define QML_UNCREATABLE(REASON)
#define QML_NAMED_ELEMENT(NAME)
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_INVOKABLE
#define Q_SLOTS
#define Q_MOC_INCLUDE(...)
#define Q_SIGNALS
unsigned int uint
Definition qtypes.h:34
QT_BEGIN_NAMESPACE typedef uchar * output
QMimeData * mimeData
QLayoutItem * child
[0]
aWidget window() -> setWindowTitle("New Window Title")
[2]
view create()