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
QWaylandSurfaceRole Class Reference

\inmodule QtWaylandCompositor More...

#include <qwaylandsurface.h>

+ Collaboration diagram for QWaylandSurfaceRole:

Public Member Functions

 QWaylandSurfaceRole (const QByteArray &n)
 Creates a QWaylandSurfaceRole and assigns it name.
 
const QByteArray name ()
 Returns the name of the QWaylandSurfaceRole.
 

Detailed Description

\inmodule QtWaylandCompositor

Since
5.8

The QWaylandSurfaceRole class represents the role of the surface in context of wl_surface.

QWaylandSurfaceRole is used to represent the role of a QWaylandSurface. According to the protocol specification, the role of a surface is permanent once set, and if the same surface is later reused for a different role, this constitutes a protocol error. Setting the surface to the same role multiple times is not an error.

As an example, the QWaylandXdgShell can assign either "popup" or "toplevel" roles to surfaces. If get_toplevel is requested on a surface which has previously received a get_popup request, then the compositor will issue a protocol error.

Roles are compared by pointer value, so any two objects of QWaylandSurfaceRole will be considered different roles, regardless of what their \l{name()}{names} are. A typical way of assigning a role is to have a static QWaylandSurfaceRole object to represent it.

class MyShellSurfaceSubType
{
static QWaylandSurfaceRole s_role;
// ...
};
// ...
surface->setRole(&MyShellSurfaceSubType::s_role, resource->handle, MY_ERROR_CODE);
\inmodule QtWaylandCompositor

Definition at line 30 of file qwaylandsurface.h.

Constructor & Destructor Documentation

◆ QWaylandSurfaceRole()

QWaylandSurfaceRole::QWaylandSurfaceRole ( const QByteArray & name)
inline

Creates a QWaylandSurfaceRole and assigns it name.

The name is used in error messages involving this QWaylandSurfaceRole.

Definition at line 33 of file qwaylandsurface.h.

Member Function Documentation

◆ name()

const QByteArray QWaylandSurfaceRole::name ( )
inline

Returns the name of the QWaylandSurfaceRole.

The name is used in error messages involving this QWaylandSurfaceRole, for example if an attempt is made to change the role of a surface.

Definition at line 35 of file qwaylandsurface.h.

Referenced by QWaylandSurface::setRole(), and QWaylandXdgShellPrivate::xdg_wm_base_get_xdg_surface().

+ Here is the caller graph for this function:

The documentation for this class was generated from the following files: