QWaylandCompositor Class

The QWaylandCompositor class manages the Wayland display server. More...

Header: #include <QWaylandCompositor>
qmake: QT += waylandcompositor
Since: Qt 5.8
Instantiated By: WaylandCompositor
Inherits: QWaylandObject

This class was introduced in Qt 5.8.

Properties

Public Functions

QWaylandCompositor(QObject *parent = nullptr)
virtual ~QWaylandCompositor() override
void addSocketDescriptor(int fd)
virtual void create()
QWaylandOutput *defaultOutput() const
QWaylandSeat *defaultSeat() const
void destroyClient(QWaylandClient *client)
void destroyClientForSurface(QWaylandSurface *surface)
virtual void grabSurface(QWaylandSurfaceGrabber *grabber, const QWaylandBufferRef &buffer)
bool isCreated() const
QWaylandOutput *outputFor(QWindow *window) const
bool retainedSelectionEnabled() const
void setDefaultOutput(QWaylandOutput *output)
void setRetainedSelectionEnabled(bool enabled)
void setSocketName(const QByteArray &name)
void setUseHardwareIntegrationExtension(bool use)
QByteArray socketName() const
bool useHardwareIntegrationExtension() const

Signals

void createdChanged()
void defaultOutputChanged()
void defaultSeatChanged(QWaylandSeat *newDevice, QWaylandSeat *oldDevice)
void retainedSelectionChanged(bool retainedSelection)
void socketNameChanged(const QByteArray &socketName)
void surfaceCreated(QWaylandSurface *surface)
void surfaceRequested(QWaylandClient *client, uint id, int version)
void useHardwareIntegrationExtensionChanged()

Detailed Description

The QWaylandCompositor manages the connections to the clients, as well as the different outputs and seats.

Normally, a compositor application will have a single WaylandCompositor instance, which can have several outputs as children.

Property Documentation

created : const bool

This property is true if QWaylandCompositor has been initialized, otherwise it's false.

Access functions:

bool isCreated() const

Notifier signal:

void createdChanged()

defaultOutput : QWaylandOutput*

This property contains the first in the list of outputs added to the QWaylandCompositor, or null if no outputs have been added.

Setting a new default output prepends it to the output list, making it the new default, but the previous default is not removed from the list. If the new default output was already in the list of outputs, it is moved to the beginning of the list.

Access functions:

QWaylandOutput *defaultOutput() const
void setDefaultOutput(QWaylandOutput *output)

Notifier signal:

void defaultOutputChanged()

defaultSeat : QWaylandSeat* const

This property contains the default seat for this QWaylandCompositor.

Access functions:

QWaylandSeat *defaultSeat() const

Notifier signal:

void defaultSeatChanged(QWaylandSeat *newDevice, QWaylandSeat *oldDevice)

retainedSelection : bool

This property holds whether retained selection is enabled.

Access functions:

bool retainedSelectionEnabled() const
void setRetainedSelectionEnabled(bool enabled)

Notifier signal:

void retainedSelectionChanged(bool retainedSelection)

socketName : QByteArray

This property holds the socket name used by QWaylandCompositor to communicate with clients. This must be set before the QWaylandCompositor is created.

If the socketName is empty (the default), the contents of the start argument --wayland-socket-name are used instead. If the argument is not set, the compositor tries to find a socket name, which is wayland-0 by default.

Access functions:

QByteArray socketName() const
void setSocketName(const QByteArray &name)

Notifier signal:

void socketNameChanged(const QByteArray &socketName)

useHardwareIntegrationExtension : bool

This property holds whether the hardware integration extension should be enabled for this QWaylandCompositor.

This property must be set before the compositor is created.

Access functions:

bool useHardwareIntegrationExtension() const
void setUseHardwareIntegrationExtension(bool use)

Notifier signal:

void useHardwareIntegrationExtensionChanged()

Member Function Documentation

QWaylandCompositor::QWaylandCompositor(QObject *parent = nullptr)

Constructs a QWaylandCompositor with the given parent.

[signal] void QWaylandCompositor::surfaceCreated(QWaylandSurface *surface)

This signal is emitted when a new QWaylandSurface instance surface has been created.

[signal] void QWaylandCompositor::surfaceRequested(QWaylandClient *client, uint id, int version)

This signal is emitted when a client has created a surface with id id. The interface version is also available.

The slot connecting to this signal may create and initialize a QWaylandSurface instance in the scope of the slot. Otherwise a default surface is created.

Connections to this signal must be of Qt::DirectConnection connection type.

[override virtual] QWaylandCompositor::~QWaylandCompositor()

Destroys the QWaylandCompositor

void QWaylandCompositor::addSocketDescriptor(int fd)

Listen for client connections on a file descriptor, fd, referring to a server socket already bound and listening.

Does not take ownership of the file descriptor; it must be closed explicitly if needed.

Note: This method is only available with libwayland 1.10.0 or newer. If built against an earlier libwayland runtime, this method is a noop.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

This function was introduced in Qt 5.12.

[virtual] void QWaylandCompositor::create()

Initializes the QWaylandCompositor. If you override this function in your subclass, be sure to call the base class implementation.

void QWaylandCompositor::destroyClient(QWaylandClient *client)

Destroys the client.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

void QWaylandCompositor::destroyClientForSurface(QWaylandSurface *surface)

Destroys the client for the surface.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

[virtual] void QWaylandCompositor::grabSurface(QWaylandSurfaceGrabber *grabber, const QWaylandBufferRef &buffer)

Grab the surface content from the given buffer. The default implementation requires a OpenGL context to be bound to the current thread to work. If this is not possible, reimplement this function in your compositor subclass to implement custom logic. The default implementation only grabs shared memory and OpenGL buffers, reimplement this in your compositor subclass to handle more buffer types.

Note: You should not call this manually, but rather use QWaylandSurfaceGrabber (grabber).

QWaylandOutput *QWaylandCompositor::outputFor(QWindow *window) const

Returns the QWaylandOutput that is connected to the given window.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

© 2023 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.