Louvre
v2.12.0-1
C++ library for Wayland compositors
|
Base class for surface roles. More...
Public Types | |
enum | CommitOrigin |
Commit origin. More... | |
Public Types inherited from LFactoryObject | |
enum class | Type : Int32 |
Base factory object types. More... | |
Public Member Functions | |
LBaseSurfaceRole (LFactoryObject::Type type, LResource *resource, LSurface *surface, UInt32 roleId) noexcept | |
Constructor of LBaseSurfaceRole class. More... | |
~LBaseSurfaceRole () | |
The LBaseSurfaceRole class destructor. More... | |
virtual const LPoint & | rolePos () const =0 |
Position of the surface given its role. More... | |
virtual LOutput * | exclusiveOutput () const |
The output to which the surface should be constrained. More... | |
UInt32 | roleId () const noexcept |
Role ID. More... | |
LSurface * | surface () const noexcept |
Returns the surface that has acquired the role provided in the constructor. More... | |
LResource * | resource () const |
Returns the Wayland resource for this role given in the constructor. More... | |
LClient * | client () const noexcept |
Client owner of the surface role. More... | |
Public Member Functions inherited from LFactoryObject | |
Type | factoryObjectType () const noexcept |
Gets the base factory object type. More... | |
Public Member Functions inherited from LObject | |
LObject (const LObject &) noexcept | |
Copy constructor. More... | |
LObject & | operator= (const LObject &) noexcept |
Assignment operator (each object has its own individual LWeak reference count). More... | |
void | setUserData (UIntPtr data) const noexcept |
Store an unsigned integer value/pointer. More... | |
UIntPtr | userData () const noexcept |
Retrieves the stored unsigned integer value/pointer. More... | |
Protected Member Functions | |
virtual bool | acceptCommitRequest (CommitOrigin origin) |
Asks if the surface commit should be processed. More... | |
virtual void | handleSurfaceCommit (CommitOrigin origin) |
Notifies a surface commit. More... | |
virtual void | handleSurfaceBufferAttach (wl_resource *buffer, Int32 x, Int32 y) |
Notifies a new surface buffer attachment. More... | |
virtual void | handleSurfaceOffset (Int32 x, Int32 y) |
Notifies a surface buffer offset change. More... | |
virtual void | handleParentCommit () |
Notifies a parent surface commit. More... | |
virtual void | handleParentMappingChange () |
Notifies when the mapping state of the parent surface changes. More... | |
virtual void | handleParentChange () |
Notifies when the parent surface changes. More... | |
Protected Member Functions inherited from LObject | |
LObject () noexcept=default | |
Constructor of the LObject class. More... | |
virtual | ~LObject () noexcept |
Destructor of the LObject class. More... | |
void | notifyDestruction () noexcept |
Notifies the object destruction. More... | |
Protected Attributes | |
LPoint | m_rolePos |
Variable that stores the surface position given the role. More... | |
Base class for surface roles.
A role defines the type and functionality of a surface. Some commonly known roles are LToplevelRole and LPopupRole.
This class is responsible, among other things, for:
The steps for creating a custom role are as follows:
wl_resource
, or use LSurface::surfaceResource() if the role does not have its own wl_resource
. wl_surface
interface.To assign the custom role to a surface at runtime, follow these steps:
setPendingRole()
method (private) on the target surface, passing the custom role instance. applyPendingRole()
method (private) to apply the pending role change. This will trigger the LSurface::roleChanged() event automatically.By following these steps, you can create a custom role and assign it to a surface dynamically during runtime.
enum CommitOrigin |
|
noexcept |
Constructor of LBaseSurfaceRole class.
resource | Resource granted by the role's protocol interface. If the role does not have a resource, the one accessible with LSurface::surfaceResource() should be passed. |
surface | Surface that will acquire the role. |
roleId | ID of the role, later accessible with the LSurface::roleId() method. Must be a value greater than 1000. |
~LBaseSurfaceRole | ( | ) |
The LBaseSurfaceRole class destructor.
|
pure virtual |
Position of the surface given its role.
This method must return the m_rolePos variable. It should be overridden to return the position of the surface according to the logic given by the role protocol.
The LSurface class returns the position given by this method when calling LSurface::rolePos().
See the default implementation of this method in the roles offered by the library for more information.
Implemented in LToplevelRole, LSubsurfaceRole, LSessionLockRole, LPopupRole, LLayerRole, LDNDIconRole, and LCursorRole.
|
inlinevirtual |
The output to which the surface should be constrained.
When this property is set, the surface should be displayed only on the specified output.
Surfaces with the LSessionLockRole or LLayerRole explicitly indicate the output on which the surface should be displayed. This property is also useful for LToplevelRole surfaces when they are maximized or in fullscreen mode.
nullptr
if not constrained to any output. Reimplemented in LToplevelRole, LSessionLockRole, LPopupRole, and LLayerRole.
|
inlinenoexcept |
Role ID.
Returns the ID of the role given in the constructor argument. The LSurface class returns this value with the LSurface::roleId() method.
|
inlinenoexcept |
Returns the surface that has acquired the role provided in the constructor.
|
inline |
Returns the Wayland resource for this role given in the constructor.
|
noexcept |
Client owner of the surface role.
|
protectedvirtual |
Asks if the surface commit should be processed.
The commit is processed only if true is returned.
origin | Origin of the request. In some protocols the commit is called by other surfaces. For example, surfaces with the subsurface role only accept commits from their parent if they are in synchronous mode. |
|
protectedvirtual |
Notifies a surface commit.
Access to the wl_surface::commit request of the surface. It should be used by protocols that require atomic changes via commits.
Notifies a new surface buffer attachment.
Access to the wl_surface::attach request of the surface.
buffer | The Wayland buffer resource. |
x | X-coordinate offset. |
y | Y-coordinate offset. |
Notifies a surface buffer offset change.
Provides access to the offset generated by the wl_surface::attach and wl_surface::offset requests.
|
protectedvirtual |
Notifies a parent surface commit.
Access to the wl_surface::commit request of the parent surface.
|
protectedvirtual |
Notifies when the mapping state of the parent surface changes.
|
protectedvirtual |
Notifies when the parent surface changes.
|
mutableprotected |
Variable that stores the surface position given the role.
Variable to store the position of the surface according to its role. It must be assigned and returned in the implementation of the LBaseSurfaceRole::rolePos() method.