QWaylandSurface Class

The QWaylandSurface class represents a rectangular area on an output device. More...

Header: #include <QWaylandSurface>
qmake: QT += waylandcompositor
Since: Qt 5.8
Inherits: QWaylandObject

This class was introduced in Qt 5.8.

Public Types

enum Origin { OriginTopLeft, OriginBottomLeft }

Properties

Public Functions

QWaylandSurface(QWaylandCompositor *compositor, QWaylandClient *client, uint id, int version)
QWaylandSurface()
virtual ~QWaylandSurface() override
int bufferScale() const
QSize bufferSize() const
QWaylandClient *client() const
QWaylandCompositor *compositor() const
Qt::ScreenOrientation contentOrientation() const
QSize destinationSize() const
void destroy()
void frameStarted()
bool hasContent() const
bool inhibitsIdle() const
void initialize(QWaylandCompositor *compositor, QWaylandClient *client, uint id, int version)
bool inputRegionContains(const QPoint &p) const
bool inputRegionContains(const QPointF &position) const
bool isCursorSurface() const
bool isDestroyed() const
bool isInitialized() const
void markAsCursorSurface(bool cursorSurface)
QWaylandSurface::Origin origin() const
QWaylandView *primaryView() const
struct wl_resource *resource() const
void sendFrameCallbacks()
void setPrimaryView(QWaylandView *view)
bool setRole(QWaylandSurfaceRole *role, wl_resource *errorResource, uint32_t errorCode)
QRectF sourceGeometry() const
QList<QWaylandView *> views() const
::wl_client *waylandClient() const

Public Slots

Signals

Static Public Members

QWaylandSurface *fromResource(::wl_resource *resource)

Detailed Description

This class encapsulates a rectangular area of pixels that is displayed on an output device. It corresponds to the interface wl_surface in the Wayland protocol.

Member Type Documentation

enum QWaylandSurface::Origin

This enum type is used to specify the origin of a QWaylandSurface's buffer.

ConstantValueDescription
QWaylandSurface::OriginTopLeft0The origin is the top left corner of the buffer.
QWaylandSurface::OriginBottomLeft1The origin is the bottom left corner of the buffer.

Property Documentation

bufferScale : const int

This property holds the QWaylandSurface's buffer scale. The buffer scale lets a client supply higher resolution buffer data for use on high resolution outputs.

Access functions:

int bufferScale() const

Notifier signal:

void bufferScaleChanged()

bufferSize : const QSize

This property holds the size of the current buffer of this QWaylandSurface in pixels, not in surface coordinates.

For the size in surface coordinates, use destinationSize instead.

Access functions:

QSize bufferSize() const

Notifier signal:

void bufferSizeChanged()

See also destinationSize and bufferScale.

client : QWaylandClient* const

This property holds the client using this QWaylandSurface.

Access functions:

QWaylandClient *client() const

contentOrientation : const Qt::ScreenOrientation

This property holds the orientation of the QWaylandSurface's contents.

Access functions:

Qt::ScreenOrientation contentOrientation() const

Notifier signal:

void contentOrientationChanged()

See also QWaylandOutput::transform.

cursorSurface : bool

This property holds whether the QWaylandSurface is a cursor surface.

Access functions:

bool isCursorSurface() const
void markAsCursorSurface(bool cursorSurface)

Notifier signal:

void cursorSurfaceChanged()

destinationSize : const QSize

This property holds the size of this WaylandSurface in surface coordinates.

This property was introduced in Qt 5.13.

Access functions:

QSize destinationSize() const

Notifier signal:

void destinationSizeChanged()

See also bufferScale and bufferSize.

hasContent : const bool

This property holds whether the QWaylandSurface has content.

Access functions:

bool hasContent() const

Notifier signal:

void hasContentChanged()

inhibitsIdle : const bool

This property holds whether this surface is intended to inhibit the idle behavior of the compositor such as screen blanking, locking and screen saving.

This property was introduced in Qt 5.14.

Access functions:

bool inhibitsIdle() const

Notifier signal:

void inhibitsIdleChanged()

See also QWaylandIdleInhibitManagerV1.

origin : const QWaylandSurface::Origin

This property holds the origin of the QWaylandSurface's buffer, or QWaylandSurface::OriginTopLeft if the surface has no buffer.

Access functions:

QWaylandSurface::Origin origin() const

Notifier signal:

void originChanged()

sourceGeometry : const QRectF

This property describes the portion of the attached QWaylandBuffer that should be drawn on the screen. The coordinates are from the corner of the buffer and are scaled by bufferScale.

This property was introduced in Qt 5.13.

Access functions:

QRectF sourceGeometry() const

Notifier signal:

void sourceGeometryChanged()

See also bufferScale, bufferSize, and destinationSize.

Member Function Documentation

QWaylandSurface::QWaylandSurface(QWaylandCompositor *compositor, QWaylandClient *client, uint id, int version)

Constructs and initializes a QWaylandSurface for the given compositor and client, and with the given id and version.

QWaylandSurface::QWaylandSurface()

Constructs a an uninitialized QWaylandSurface.

[signal] void QWaylandSurface::childAdded(QWaylandSurface *child)

This signal is emitted when a wl_subsurface, child, has been added to the surface.

[signal] void QWaylandSurface::dragStarted(QWaylandDrag *drag)

This signal is emitted when a drag has started from this surface.

[signal] void QWaylandSurface::surfaceDestroyed()

This signal is emitted when the corresponing wl_surface is destroyed.

[slot] void QWaylandSurface::updateSelection()

Updates the surface with the compositor's retained clipboard selection. Although this is done automatically when the surface receives keyboard focus, this function is useful for updating clients which do not have keyboard focus.

[override virtual] QWaylandSurface::~QWaylandSurface()

Destroys the QWaylandSurface.

QWaylandCompositor *QWaylandSurface::compositor() const

Returns the compositor for this QWaylandSurface.

void QWaylandSurface::destroy()

Destroys the QWaylandSurface.

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

void QWaylandSurface::frameStarted()

Prepares all frame callbacks for sending.

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

[static] QWaylandSurface *QWaylandSurface::fromResource(::wl_resource *resource)

Returns the QWaylandSurface corresponding to the Wayland resource resource.

void QWaylandSurface::initialize(QWaylandCompositor *compositor, QWaylandClient *client, uint id, int version)

Initializes the QWaylandSurface with the given compositor and client, and with the given id and version.

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

bool QWaylandSurface::inputRegionContains(const QPoint &p) const

Returns true if the QWaylandSurface's input region contains the point p. Otherwise returns false.

bool QWaylandSurface::inputRegionContains(const QPointF &position) const

Returns true if the QWaylandSurface's input region contains the point position. Otherwise returns false.

This function was introduced in Qt 5.14.

bool QWaylandSurface::isDestroyed() const

Returns true if the QWaylandSurface has been destroyed. Otherwise returns false.

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

bool QWaylandSurface::isInitialized() const

Returns true if the QWaylandSurface has been initialized.

QWaylandView *QWaylandSurface::primaryView() const

Returns this QWaylandSurface's primary view.

See also QWaylandView::advance() and QWaylandSurface::setPrimaryView().

struct wl_resource *QWaylandSurface::resource() const

Returns the Wayland resource corresponding to this QWaylandSurface.

void QWaylandSurface::sendFrameCallbacks()

Sends pending frame callbacks.

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

void QWaylandSurface::setPrimaryView(QWaylandView *view)

Sets this QWaylandSurface's primary view to view, in case there are multiple views of this surface. The primary view is the view that governs the client's refresh rate. It takes care of discarding buffer references when QWaylandView::advance() is called. See the documentation for QWaylandView::advance() for more details.

In shell surface integrations, such as QWaylandWlShellIntegration and QWaylandXdgShellV5Integration, maximize and fullscreen requests from the client will only have an effect if the integration has the primary view of the surface.

See also primaryView() and QWaylandView::advance().

bool QWaylandSurface::setRole(QWaylandSurfaceRole *role, wl_resource *errorResource, uint32_t errorCode)

Sets a role on the surface. A role defines how a surface will be mapped on screen; without a role a surface is supposed to be hidden. Only one role can be set on a surface, at all times. Although setting the same role many times is allowed, attempting to change the role of a surface will trigger a protocol error to the errorResource and send an errorCode to the client.

Returns true if a role can be assigned; false otherwise.

QList<QWaylandView *> QWaylandSurface::views() const

Returns the views for this QWaylandSurface.

::wl_client *QWaylandSurface::waylandClient() const

Holds the wl_client using this QWaylandSurface.

© 2021 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.