Louvre  v2.13.0-1
C++ library for Wayland compositors
Public Types | Public Member Functions | List of all members
LSurface Class Reference

A client "window". More...

+ Inheritance diagram for LSurface:

Public Types

enum  Role : UInt32
 ID of library roles. More...
 
enum  PointerConstraintMode
 Pointer constraint modes. More...
 
- Public Types inherited from LFactoryObject
enum class  Type : Int32
 Base factory object types. More...
 

Public Member Functions

 LSurface (const void *params) noexcept
 Constructor of the LSurface class. More...
 
 ~LSurface ()
 Destructor of the LSurface class. More...
 
LSurfaceLayer layer () const noexcept
 Retrieves the layer in which this surface currently resides. More...
 
void setPos (const LPoint &newPos) noexcept
 Assigns the position. More...
 
void setPos (Int32 x, Int32 y) noexcept
 Assigns the position. More...
 
void setX (Int32 x) noexcept
 Assigns the x component of the position. More...
 
void setY (Int32 y) noexcept
 Assigns the y component of the position. More...
 
const LPointpos () const noexcept
 Position given by the compositor. More...
 
const LPointrolePos () const
 Role position. More...
 
const LSizesizeB () const noexcept
 Surface size in buffer coordinates. More...
 
const LSizesize () const noexcept
 Surface size in surface coordinates. More...
 
const LRegioninputRegion () const noexcept
 Input region in surface coordinates. More...
 
const LRegionopaqueRegion () const noexcept
 Opaque region in surface coordinates. More...
 
const LRegiontranslucentRegion () const noexcept
 Translucent region in surface coordinates. More...
 
const LRegiondamage () const noexcept
 Damaged region in surface coordinates. More...
 
const LRegiondamageB () const noexcept
 Damaged region in buffer coordinates. More...
 
LContentType contentType () const noexcept
 Returns the content type that the surface represents. More...
 
void sendOutputEnterEvent (LOutput *output) noexcept
 Notify the client when the surface enters an output. More...
 
void sendOutputLeaveEvent (LOutput *output) noexcept
 Notify the client when the surface leaves an output. More...
 
const std::vector< LOutput * > & outputs () const noexcept
 Surface intersected outputs. More...
 
void repaintOutputs () noexcept
 Repaints the intersected outputs. More...
 
bool minimized () const noexcept
 Minimized property. More...
 
void setMinimized (bool state)
 Sets the minimized property. More...
 
bool receiveInput () const noexcept
 Input capability. More...
 
Int32 bufferScale () const noexcept
 Buffer scale. More...
 
LTransform bufferTransform () const noexcept
 Gets the buffer transform of the surface. More...
 
const LRectFsrcRect () const noexcept
 Gets the source rect of the surface in surface coordinates. More...
 
bool hasPointerFocus () const noexcept
 Check if the surface has pointer focus. More...
 
bool hasKeyboardFocus () const noexcept
 Check if the surface has keyboard focus. More...
 
bool hasKeyboardGrab () const noexcept
 Check if the surface is grabbing the keyboard. More...
 
LTexturetexture () const noexcept
 OpenGL texture. More...
 
wl_buffer * bufferResource () const noexcept
 Native wl_buffer handle. More...
 
bool hasBuffer () const noexcept
 Indicates if the last attached buffer was NULL. More...
 
bool hasDamage () const noexcept
 Presence of damage. More...
 
UInt32 damageId () const noexcept
 Gets an ID that increments with each commit and new damage addition. More...
 
void requestNextFrame (bool clearDamage=true) noexcept
 ACK the frame callback. More...
 
bool mapped () const noexcept
 Mapped property. More...
 
bool preferVSync () noexcept
 Gets the VSync preference of the client for this surface. More...
 
const std::vector< LSurfaceView * > & views () const noexcept
 LSurfaceViews created for this surface. More...
 
Protocols::Wayland::RSurface * surfaceResource () const noexcept
 Wayland surface resource. More...
 
std::vector< Protocols::IdleInhibit::RIdleInhibitor * > idleInhibitorResources () const noexcept
 Idle Inhibitor Resources. More...
 
LClientclient () const noexcept
 Client owner of the surface. More...
 
LSurfaceparent () const noexcept
 Parent surface. More...
 
LSurfacetopmostParent () const noexcept
 Topmost parent of the surface. More...
 
const std::list< LSurface * > & children () const noexcept
 Child surfaces. More...
 
bool isPopupSubchild () const noexcept
 Check if the surface is a subchild of a popup. More...
 
bool hasPopupSubchild () const noexcept
 Check if the surface has a subchild popup. More...
 
bool isSubchildOf (LSurface *parent) const noexcept
 Check if the surface is a subchild of the specified parent surface. More...
 
void raise ()
 Raises the surface within its current layer. More...
 
LSurfaceprevSurface () const noexcept
 Retrieve the previous surface in the compositor surfaces list (LCompositor::surfaces()). More...
 
LSurfacenextSurface () const noexcept
 Retrieve the next surface in the compositor surfaces list (LCompositor::surfaces()). 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...
 
LObjectoperator= (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...
 

Roles

Functionality related to roles.

Role roleId () const noexcept
 ID of the role. More...
 
LBaseSurfaceRolerole () const noexcept
 Surface role. More...
 
LCursorRolecursorRole () const noexcept
 Cursor role. More...
 
LDNDIconRoledndIcon () const noexcept
 Drag & Drop icon role. More...
 
LToplevelRoletoplevel () const noexcept
 Toplevel role. More...
 
LPopupRolepopup () const noexcept
 Popup role. More...
 
LSubsurfaceRolesubsurface () const noexcept
 Subsurface role. More...
 
LSessionLockRolesessionLock () const noexcept
 Session Lock role. More...
 
LLayerRolelayerRole () const noexcept
 Layer role. More...
 

Pointer Constraints

Functionality related to pointer constraints.

See also
LPointer::pointerMoveEvent()
PointerConstraintMode pointerConstraintMode () const noexcept
 Current pointer constraint mode. More...
 
virtual void pointerConstraintModeChanged ()
 Invoked when pointerConstraintMode() changes. More...
 
const LRegionpointerConstraintRegion () const noexcept
 Region within the surface where the pointer should be locked or confined if pointer constraint is enabled. More...
 
virtual void pointerConstraintRegionChanged ()
 Notifies a change in pointerConstraintRegion(). More...
 
void enablePointerConstraint (bool enabled)
 Notifies the client if the pointer is constrained. More...
 
bool pointerConstraintEnabled () const noexcept
 Indicates if the compositor enabled the pointer constraint for this surface. More...
 
const LPointFlockedPointerPosHint () const noexcept
 Indicates where the pointer currently is within the surface if the pointer Lock constrain mode is enabled. More...
 
virtual void lockedPointerPosHintChanged ()
 Notifies a change in lockedPointerPosHint(). More...
 

Virtual Methods

virtual void damageChanged ()
 Notifies about new damages on the surface. More...
 
virtual void roleChanged ()
 Notifies a change of role. More...
 
virtual void parentChanged ()
 Notifies a change of parent. More...
 
virtual void mappingChanged ()
 Notifies a change in the mapping state. More...
 
virtual void bufferScaleChanged ()
 Notifies a change in buffer scale. More...
 
virtual void bufferTransformChanged ()
 Notifies a change of the buffer transform. More...
 
virtual void bufferSizeChanged ()
 Notifies a change in buffer dimensions. More...
 
virtual void sizeChanged ()
 Notifies a change in the surface size. More...
 
virtual void srcRectChanged ()
 Notifies a change in the src rect. More...
 
virtual void opaqueRegionChanged ()
 Notifies of a change in the opaque region. More...
 
virtual void inputRegionChanged ()
 Notifies of a change in the input region. More...
 
virtual void orderChanged ()
 Notifies when the surface changes its position in the surfaces list. More...
 
virtual void requestedRepaint ()
 Request a repaint of the surface. More...
 
virtual void minimizedChanged ()
 Notifies about changes in the minimized state of the surface. More...
 
virtual void preferVSyncChanged ()
 Notifies about changes in the VSync preference. More...
 
virtual void contentTypeChanged ()
 Notifies a change of content type. More...
 
virtual void layerChanged ()
 Notified a c. More...
 

Additional Inherited Members

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

Detailed Description

A client "window".

In the context of Wayland, surfaces can be thought of as analogous to "application windows." Each surface possesses attributes including position, size, buffer, input region, opaque region, damage region, and a designated role. Clients are responsible for rendering the content of their windows onto a buffer and subsequently transmitting it to the compositor, which is then displayed on the screen.

Roles

Surfaces on their own lack functionality. This is where roles come into play, as they establish the guidelines for how the compositor interacts with them, dictating their ordering, positioning, geometry interpretation, and more.
Louvre currently implements the following roles:

The surface's role can be accessed using the role() method or, if you already know the role in advance or wish to verify whether it matches one of them, through the dedicated functions: cursorRole(), dndIcon(), popup(), toplevel(), subsurface(), etc.
Typically, once a role is assigned, it remains consistent throughout the surface's entire lifecycle.
You have the option to monitor changes in the surface's role by utilizing the roleChanged() event.
To create additional roles beyond those offered by the library you can use the LBaseSurfaceRole class.

Mapping

In order to render a surface, several conditions must be met, such as having an assigned role and a non-null buffer().
To determine if a surface is renderable, you can use the mapped() property. This property is false when the client wants to hide it through some rule of its role, or when the necessary conditions for it to be rendered are not met.

Callbacks

To ensure that surfaces don't update their content more frequently than the refresh rate of the output (LOutput) they are displayed on, or in scenarios where they are obscured by other surfaces, callbacks are employed. Clients generate a callback resource and await the compositor's acknowledgment, signaling an optimal time to render the subsequent surface frame. To acknowledge the callback of a surface, use requestNextFrame().

Warning
Calling requestNextFrame() clears the current damage region of the surface.

Buffer

The library automatically converts the surface's buffer into an object that can be used by the selected renderer.
Since the library currently only offers OpenGL ES 2.0 renderer, the buffer is converted to an OpenGL texture that can be accessed with texture().
It is also possible to access the native Wayland resource of the buffer with bufferResource().

Damage

To avoid the compositor redrawing the entire area of a surface on each frame, clients notify which regions have changed on their buffers, known as damage. You can access this region with damage() or damageB() and be notified when it changes with the damageChanged() event.

Note
The default implementation of LOutput::paintGL() does not take into account the damage of surfaces, and therefore it renders in an inefficient way. It's recommended to use the LScene and LView system for rendering, which efficiently repaints only what is necessary during each frame. If you want to see an example of efficient rendering, check the louvre-views or louvre-weston-clone examples.

Order

Louvre maintains a list to keep track of all surfaces created by clients, which can be accessed via LCompositor::surfaces().
This list adheres to the Z-axis order as defined by the protocols of their respective roles.
Surfaces are always assigned a layer, which is controlled by their role. Both the surfaces list and layers maintain the same order.
Surfaces are assigned to a layer as follows:

Note
LSubsurfaceRole and transient LToplevelRole surfaces are always assigned the same layer as their parent surface.

It is possible to modify the order of surfaces within a layer using the raise() method, this will normally also raise other surfaces such as subsurfaces.
You can receive notifications when the order changes by implementing the orderChanged() and layerChanged() virtual methods.
Use prevSurface() and nextSurface() to get the surface behind or on top of the current surface. Keep in mind that these functions may return nullptr if a surface is at the beginning or end of the LCompositor::surfaces() list.
Surfaces are thought to be rendered in the order they appear in the list. The first surfaces should be located in the background, while the last ones should be in the foreground.

Note
If you want to use a different ordering, you could leverage the LCompositor factory constructor/destructor respectively to listen for when clients create or destroy a surface.

Position

One of the characteristics of Wayland is that clients have very little information and control over how their surfaces are positioned on the screen.
For this reason, the rules of their roles generally define it based on an offset relative to another surface, an output or a position given by you.
Louvre simplifies this by allowing you to assign the position of the surfaces with setPos() and access the position suggested by its role with rolePos().
In some cases, such as in the LPopupRole or LSubsurfaceRole role, the position set with setPos() is not taken into account.
You can see the positioning rules of each role in detail by viewing the documentation of rolePos() for each one.

Member Enumeration Documentation

◆ Role

enum Role : UInt32

ID of library roles.

ID of the current role of the surface accessible with roleId()

Enumerator
Undefined 

No role set.

Toplevel 

LToplevelRole.

Popup 

LPopupRole.

Subsurface 

LSubsurfaceRole.

Cursor 

LCursorRole.

DNDIcon 

LDNDIconRole.

SessionLock 

LSessionLockRole (since v2.0.0)

Layer 

LLayerRole (since v2.0.0)

◆ PointerConstraintMode

Pointer constraint modes.

Enumerator
Free 

No pointer constraint, the pointer is free to move anywhere.

Lock 

Lock the pointer position somewhere inside pointerConstraintRegion().

Confine 

Confine the pointer to pointerConstraintRegion().

Constructor & Destructor Documentation

◆ LSurface()

LSurface ( const void *  params)
noexcept

Constructor of the LSurface class.

Parameters
paramsInternal parameters provided in LCompositor::createObjectRequest().

◆ ~LSurface()

~LSurface ( )

Destructor of the LSurface class.

Invoked after LCompositor::onAnticipatedObjectDestruction().

Member Function Documentation

◆ layer()

LSurfaceLayer layer ( ) const
noexcept

Retrieves the layer in which this surface currently resides.

See also
LCompositor::layer()
LSurfaceLayer
layerChanged()
Returns
The layer ID of the surface.

◆ setPos() [1/2]

void setPos ( const LPoint newPos)
noexcept

Assigns the position.

Assigns the position of the surface.

◆ setPos() [2/2]

void setPos ( Int32  x,
Int32  y 
)
noexcept

Assigns the position.

Assigns the position of the surface.

◆ setX()

void setX ( Int32  x)
noexcept

Assigns the x component of the position.

Assigns the x component of the position of the surface.

◆ setY()

void setY ( Int32  y)
noexcept

Assigns the y component of the position.

Assigns the y component of the position of the surface.

◆ pos()

const LPoint & pos ( ) const
noexcept

Position given by the compositor.

Position of the surface assigned with setPos(), setX() or setY().

◆ rolePos()

const LPoint & rolePos ( ) const

Role position.

Role position in surface coordinates. If the surface has no role, the same value as pos() is returned.

◆ sizeB()

const LSize & sizeB ( ) const
noexcept

Surface size in buffer coordinates.

◆ size()

const LSize & size ( ) const
noexcept

Surface size in surface coordinates.

◆ inputRegion()

const LRegion & inputRegion ( ) const
noexcept

Input region in surface coordinates.

Region of the surface that is capable of receiving input, in surface coordinates.

◆ opaqueRegion()

const LRegion & opaqueRegion ( ) const
noexcept

Opaque region in surface coordinates.

◆ translucentRegion()

const LRegion & translucentRegion ( ) const
noexcept

Translucent region in surface coordinates.

Translucent region in surface coordinates (inverted opaque region).

◆ damage()

const LRegion & damage ( ) const
noexcept

Damaged region in surface coordinates.

◆ damageB()

const LRegion & damageB ( ) const
noexcept

Damaged region in buffer coordinates.

◆ contentType()

LContentType contentType ( ) const
noexcept

Returns the content type that the surface represents.

Clients using the Content Type Hint protocol can indicate the type of content a particular surface is displaying.
This information can be used, for example, to adapt the compositor behavior and to optimize the functioning of hardware displays when assigned to outputs through LOutput::setContentType().

The default value is LContentTypeNone.

See also
LOutput::setContentType() and LSurface::contentTypeChanged()

◆ sendOutputEnterEvent()

void sendOutputEnterEvent ( LOutput output)
noexcept

Notify the client when the surface enters an output.

This method notifies the surface's client that the surface has become visible within the display area of a specific output. The client application can use this information to synchronize the surface's scale with that of the output. You can access the list of outputs where the surface is visible using the outputs() method.

Note
This method can be safely called multiple times with the same output as an argument because it internally checks whether the client has already been notified.
Parameters
outputThe output into which the surface has entered.

◆ sendOutputLeaveEvent()

void sendOutputLeaveEvent ( LOutput output)
noexcept

Notify the client when the surface leaves an output.

This method informs the surface's client application that the surface is no longer visible on a particular output. You can access the list of outputs where the surface is still visible using the outputs() method.

Note
This method can be safely called multiple times with the same output as an argument because it internally checks whether the client has already been notified.
Parameters
outputThe output from which the surface is no longer visible.

◆ outputs()

const std::vector< LOutput * > & outputs ( ) const
noexcept

Surface intersected outputs.

Vector of output pointers in which the surface is visible, modifiable with the sendOutputEnterEvent() and sendOutputLeaveEvent() methods.

◆ repaintOutputs()

void repaintOutputs ( )
noexcept

Repaints the intersected outputs.

Invokes the LOutput::repaint() method on all outputs listed in outputs().

◆ minimized()

bool minimized ( ) const
noexcept

Minimized property.

Stores the minimized state of the surface set with setMinimized().

Returns
true if the surface is minimized and false otherwise.

◆ setMinimized()

void setMinimized ( bool  state)

Sets the minimized property.

Minimize/unminimize the surface and all its children.

◆ receiveInput()

bool receiveInput ( ) const
noexcept

Input capability.

Indicates whether the surface is able to receive pointer or touch input events.

◆ bufferScale()

Int32 bufferScale ( ) const
noexcept

Buffer scale.

Scale of the surface buffer. You can listen for changes to this property with the bufferScaleChanged() event.

◆ bufferTransform()

LTransform bufferTransform ( ) const
noexcept

Gets the buffer transform of the surface.

Returns
The buffer transform applied to the surface.

◆ srcRect()

const LRectF & srcRect ( ) const
noexcept

Gets the source rect of the surface in surface coordinates.

For clients using the Viewporter protocol, a custom srcRect() detached from the buffer size can be specified. For clients not using the protocol, the source rect covers the entire surface buffer.

◆ hasPointerFocus()

bool hasPointerFocus ( ) const
noexcept

Check if the surface has pointer focus.

Returns
true if the surface has pointer focus, false otherwise.

◆ hasKeyboardFocus()

bool hasKeyboardFocus ( ) const
noexcept

Check if the surface has keyboard focus.

Returns
true if the surface has keyboard focus, false otherwise.

◆ hasKeyboardGrab()

bool hasKeyboardGrab ( ) const
noexcept

Check if the surface is grabbing the keyboard.

Returns
true if the surface is grabbing the keyboard, false otherwise.

◆ texture()

LTexture * texture ( ) const
noexcept

OpenGL texture.

Representation of the surface's buffer as an OpenGL texture.

Warning
It could return nullptr if the surface is not currently mapped.

◆ bufferResource()

wl_buffer * bufferResource ( ) const
noexcept

Native wl_buffer handle.

Handle to the last commited Wayland buffer of the surface.

Warning
It could return nullptr if the surface is not currently mapped.

◆ hasBuffer()

bool hasBuffer ( ) const
noexcept

Indicates if the last attached buffer was NULL.

Note
Even if this method returns true, bufferResource() may return nullptr if the buffer was destroyed before being replaced by another attach and commit.
Returns
true if the last attached buffer was not NULL, otherwise false.

◆ hasDamage()

bool hasDamage ( ) const
noexcept

Presence of damage.

Indicates if the surface has new damage since the last time the requestNextFrame() method was called.
You can access the damaged region with damage() or damageB().

◆ damageId()

UInt32 damageId ( ) const
noexcept

Gets an ID that increments with each commit and new damage addition.

The ID increments every time the surface is committed and new damage is added.

Returns
The incremental damage ID of the surface.

◆ requestNextFrame()

void requestNextFrame ( bool  clearDamage = true)
noexcept

ACK the frame callback.

Notifies the surface that it's time for it to draw its next frame.
If not called, the given surface should not update its content.

Warning
This method clears the current damage region of the surface.

◆ mapped()

bool mapped ( ) const
noexcept

Mapped property.

Indicates if the surface can be rendered.

◆ preferVSync()

bool preferVSync ( )
noexcept

Gets the VSync preference of the client for this surface.

See also
LOutput::enableVSync()
Returns
true if VSync is preferred, false if tearing is preferred.

◆ views()

const std::vector< LSurfaceView * > & views ( ) const
noexcept

LSurfaceViews created for this surface.

◆ surfaceResource()

Wayland::RSurface * surfaceResource ( ) const
noexcept

Wayland surface resource.

Returns the resource generated by the wl_surface interface of the Wayland protocol.

◆ idleInhibitorResources()

std::vector< IdleInhibit::RIdleInhibitor * > idleInhibitorResources ( ) const
noexcept

Idle Inhibitor Resources.

◆ client()

LClient * client ( ) const
noexcept

Client owner of the surface.

◆ parent()

LSurface * parent ( ) const
noexcept

Parent surface.

Returns
A pointer to the parent surface or nullptr if it does not have a parent.

◆ topmostParent()

LSurface * topmostParent ( ) const
noexcept

Topmost parent of the surface.

Returns
A pointer to the topmost parent of the surface, or nullptr if it does not have a parent.

◆ children()

const std::list< LSurface * > & children ( ) const
noexcept

Child surfaces.

List of child surfaces.

◆ isPopupSubchild()

bool isPopupSubchild ( ) const
noexcept

Check if the surface is a subchild of a popup.

This method determines whether the surface is a subchild of a popup surface. It returns true if the surface is a subchild of a popup surface in the hierarchy; otherwise, it returns false.

Returns
true if the surface is a subchild of a popup surface, false otherwise.

◆ hasPopupSubchild()

bool hasPopupSubchild ( ) const
noexcept

Check if the surface has a subchild popup.

This method checks whether the surface has a subchild popup surface. It returns true if the surface has a popup subchild; otherwise, it returns false.

Returns
true if the surface has a subchild popup, false otherwise.

◆ isSubchildOf()

bool isSubchildOf ( LSurface parent) const
noexcept

Check if the surface is a subchild of the specified parent surface.

This method checks whether the surface is a subchild of the provided parent surface.

Parameters
parentA pointer to the potential parent LSurface to check against.
Returns
true if the surface is a subchild of the provided parent surface, false otherwise.

◆ raise()

void raise ( )

Raises the surface within its current layer.

This method reinserts the surface at the end of its current layer's list, ensuring its position above other surfaces within the same layer.
If the surface is parent of other surfaces, those child surfaces will also be raised to maintain the hierarchical order required by certain protocols.

Note
Calling this method during the handling of an orderChanged() event is not allowed, and doing so will result in a no-op.

◆ prevSurface()

LSurface * prevSurface ( ) const
noexcept

Retrieve the previous surface in the compositor surfaces list (LCompositor::surfaces()).

This method returns a pointer to the surface that precedes the current surface in the compositor's surfaces list. If the current surface is the first one in the list, the method returns nullptr.

Returns
A pointer to the previous LSurface or nullptr if the current surface is the first in the list.

◆ nextSurface()

LSurface * nextSurface ( ) const
noexcept

Retrieve the next surface in the compositor surfaces list (LCompositor::surfaces()).

This method returns a pointer to the surface that follows the current surface in the compositor's surfaces list. If the current surface is the last one in the list, the method returns nullptr.

Returns
A pointer to the next LSurface or nullptr if the current surface is the last in the list.

◆ roleId()

LSurface::Role roleId ( ) const
noexcept

ID of the role.

Returns
The ID of the surface's role or LSurface::Undefined if it does not have a role.

◆ role()

LBaseSurfaceRole * role ( ) const
noexcept

Surface role.

Returns
A pointer to the surface's role or nullptr if it does not have a role.

◆ cursorRole()

LCursorRole * cursorRole ( ) const
noexcept

Cursor role.

Returns
A pointer to an instance of LCursorRole or nullptr if it has a different role.

◆ dndIcon()

LDNDIconRole * dndIcon ( ) const
noexcept

Drag & Drop icon role.

Returns
A pointer to an instance of LDNDIconRole or nullptr if it has a different role.

◆ toplevel()

LToplevelRole * toplevel ( ) const
noexcept

Toplevel role.

Returns
A pointer to an instance of LToplevelRole or nullptr if it has a different role.

◆ popup()

LPopupRole * popup ( ) const
noexcept

Popup role.

Returns
A pointer to an instance of LPopupRole or nullptr if it has a different role.

◆ subsurface()

LSubsurfaceRole * subsurface ( ) const
noexcept

Subsurface role.

Returns
A pointer to an instance of LSubsurfaceRole or nullptr if it has a different role.

◆ sessionLock()

LSessionLockRole * sessionLock ( ) const
noexcept

Session Lock role.

Returns
A pointer to an instance of LSessionLockRole or nullptr if it has a different role.

◆ layerRole()

LLayerRole * layerRole ( ) const
noexcept

Layer role.

Returns
A pointer to an instance of LLayerRole or nullptr if it has a different role.

◆ pointerConstraintMode()

LSurface::PointerConstraintMode pointerConstraintMode ( ) const
noexcept

Current pointer constraint mode.

Returns the current mode in which the client wants to constrain the pointer.

Note
The pointer constraint is not enabled automatically, see enablePointerConstraint().

◆ pointerConstraintModeChanged()

virtual void pointerConstraintModeChanged ( )
virtual

Invoked when pointerConstraintMode() changes.

Each time the pointer constraint mode changes, the pointer constraint is disabled and enablePointerConstraint() must be called again to enable it.

Default implementation

{
/* No default implementation */
}
virtual void pointerConstraintModeChanged()
Invoked when pointerConstraintMode() changes.

◆ pointerConstraintRegion()

const LRegion & pointerConstraintRegion ( ) const
noexcept

Region within the surface where the pointer should be locked or confined if pointer constraint is enabled.

Returns the region within the surface where the pointer should be locked or confined if the pointer constraint is enabled.

Returns
The region where the pointer should be constrained within the surface.
See also
LRegion::closestPointFrom()

◆ pointerConstraintRegionChanged()

virtual void pointerConstraintRegionChanged ( )
virtual

Notifies a change in pointerConstraintRegion().

Default implementation

{
/* No default implementation */
}
virtual void pointerConstraintRegionChanged()
Notifies a change in pointerConstraintRegion().

◆ enablePointerConstraint()

void enablePointerConstraint ( bool  enabled)

Notifies the client if the pointer is constrained.

The surface must have pointer focus prior to calling this method and have either a Lock or Confine PointerConstraintMode, otherwise, it is a no-op.

Parameters
enabledBoolean indicating if the pointer constraint is enabled.

◆ pointerConstraintEnabled()

bool pointerConstraintEnabled ( ) const
noexcept

Indicates if the compositor enabled the pointer constraint for this surface.

It is automatically set to false if the surface loses pointer focus or the pointerConstraintMode() property changes.

See also
enablePointerConstraint()
Returns
true if the pointer constraint is enabled for this surface, false otherwise.

◆ lockedPointerPosHint()

const LPointF & lockedPointerPosHint ( ) const
noexcept

Indicates where the pointer currently is within the surface if the pointer Lock constrain mode is enabled.

If pointerConstraintMode() is not Lock or the client has never set this property, it returns (-1.f, -1.f).

◆ lockedPointerPosHintChanged()

virtual void lockedPointerPosHintChanged ( )
virtual

Notifies a change in lockedPointerPosHint().

Default implementation

{
/* No default implementation */
}
virtual void lockedPointerPosHintChanged()
Notifies a change in lockedPointerPosHint().

◆ damageChanged()

virtual void damageChanged ( )
virtual

Notifies about new damages on the surface.

Reimplement this virtual method if you want to be notified when the surface has new damage.

Default Implementation

{
}
void repaintOutputs() noexcept
Repaints the intersected outputs.
Definition: LSurface.cpp:196
virtual void damageChanged()
Notifies about new damages on the surface.

◆ roleChanged()

virtual void roleChanged ( )
virtual

Notifies a change of role.

Reimplement this virtual method if you want to be notified when the surface changes its role.

Default implementation

{
}
virtual void roleChanged()
Notifies a change of role.

◆ parentChanged()

virtual void parentChanged ( )
virtual

Notifies a change of parent.

Reimplement this virtual method if you want to be notified when the surface changes its parent.

Default implementation

{
}
virtual void parentChanged()
Notifies a change of parent.

◆ mappingChanged()

virtual void mappingChanged ( )
virtual

Notifies a change in the mapping state.

Reimplement this virtual method if you want to be notified when the surface changes its mapping state.

Default implementation

{
LOutput *activeOutput { cursor()->output() };
if (!activeOutput)
return;
/* If the surface is a toplevel, we place it at the center of the screen */
if (mapped() && toplevel())
{
const LSize size {
+ LSize(toplevel()->extraGeometry().left + toplevel()->extraGeometry().right,
toplevel()->extraGeometry().top + toplevel()->extraGeometry().bottom)
};
const LSize availGeoPos { activeOutput->pos() + activeOutput->availableGeometry().pos() };
setPos(availGeoPos + (activeOutput->availableGeometry().size() - size) / 2);
if (pos().y() < availGeoPos.y())
setY(availGeoPos.y());
}
}
void repaintAllOutputs() noexcept
Unlocks the rendering thread of all initialized outputs.
Definition: LCompositor.cpp:453
LOutput * output() const noexcept
Gets the current cursor output.
Definition: LCursor.cpp:348
constexpr T y() const noexcept
Second component of the vector.
Definition: LPoint.h:40
constexpr const LPointTemplate< T > & size() const noexcept
2D vector given by the (w,h) components of the rectangle
Definition: LRect.h:131
const LPoint & pos() const noexcept
Position given by the compositor.
Definition: LSurface.cpp:321
virtual void mappingChanged()
Notifies a change in the mapping state.
LToplevelRole * toplevel() const noexcept
Toplevel role.
Definition: LSurface.cpp:60
void setY(Int32 y) noexcept
Assigns the y component of the position.
Definition: LSurface.cpp:129
bool mapped() const noexcept
Mapped property.
Definition: LSurface.cpp:441
void setPos(const LPoint &newPos) noexcept
Assigns the position.
const LSize & size() const noexcept
Surface size in surface coordinates.
Definition: LSurface.cpp:139
const LRect & windowGeometry() const noexcept
Window geometry in surface coordinates.
Definition: LToplevelRole.h:537
LCursor * cursor() noexcept
Gets the compositor's cursor.
Definition: LCompositor.cpp:47
LPoint LSize
2D vector of 32 bits integers
Definition: LNamespaces.h:253
LCompositor * compositor() noexcept
Gets the static LCompositor instance.
Definition: LCompositor.cpp:37

◆ bufferScaleChanged()

virtual void bufferScaleChanged ( )
virtual

Notifies a change in buffer scale.

Reimplement this virtual method if you want to be notified when the surface's buffer scale changes.

Default Implementation

{
}
virtual void bufferScaleChanged()
Notifies a change in buffer scale.

◆ bufferTransformChanged()

virtual void bufferTransformChanged ( )
virtual

Notifies a change of the buffer transform.

Reimplement this virtual method if you want to be notified when the surface's buffer transform changes.

Default Implementation

{
}
virtual void bufferTransformChanged()
Notifies a change of the buffer transform.

◆ bufferSizeChanged()

virtual void bufferSizeChanged ( )
virtual

Notifies a change in buffer dimensions.

Reimplement this virtual method if you want to be notified when the buffer size (sizeB()) changes.

Default Implementation

{
}
virtual void bufferSizeChanged()
Notifies a change in buffer dimensions.

◆ sizeChanged()

virtual void sizeChanged ( )
virtual

Notifies a change in the surface size.

Reimplement this virtual method if you want to be notified when the surface size() changes.

Note
This event differs from bufferSizeChanged(). The surface size() may change when the client applies a different scale factor, transform or sets a custom destination size while using the Viewport protocol.

Default Implementation

{
}
virtual void sizeChanged()
Notifies a change in the surface size.

◆ srcRectChanged()

virtual void srcRectChanged ( )
virtual

Notifies a change in the src rect.

Reimplement this virtual method if you want to be notified when srcRect() changes.

Default Implementation

{
}
virtual void srcRectChanged()
Notifies a change in the src rect.

◆ opaqueRegionChanged()

virtual void opaqueRegionChanged ( )
virtual

Notifies of a change in the opaque region.

Reimplement this virtual method if you wish to be notified when the surface changes its opaque region.

Default Implementation

{
}
virtual void opaqueRegionChanged()
Notifies of a change in the opaque region.

◆ inputRegionChanged()

virtual void inputRegionChanged ( )
virtual

Notifies of a change in the input region.

Reimplement this virtual method if you want to be notified when the surface changes its input region.

Default Implementation

{
/* No default implementation */
}
virtual void inputRegionChanged()
Notifies of a change in the input region.

◆ orderChanged()

virtual void orderChanged ( )
virtual

Notifies when the surface changes its position in the surfaces list.

Override this virtual method if you wish to be informed about changes in the order of the surface within the compositor's list of surfaces.

Default Implementation

{
}
virtual void orderChanged()
Notifies when the surface changes its position in the surfaces list.

◆ requestedRepaint()

virtual void requestedRepaint ( )
virtual

Request a repaint of the surface.

This request can be initiated either by the library or by the client, serving as an explicit command to repaint the surface.

Default Implementation

{
}
virtual void requestedRepaint()
Request a repaint of the surface.

◆ minimizedChanged()

virtual void minimizedChanged ( )
virtual

Notifies about changes in the minimized state of the surface.

This method is called to signal changes in the minimized state of the surface.

Default Implementation

{
}
virtual void minimizedChanged()
Notifies about changes in the minimized state of the surface.

◆ preferVSyncChanged()

virtual void preferVSyncChanged ( )
virtual

Notifies about changes in the VSync preference.

This event is triggered when the preferVSync() property changes.

Default Implementation

{
/* No default implementation */
}
virtual void preferVSyncChanged()
Notifies about changes in the VSync preference.

◆ contentTypeChanged()

virtual void contentTypeChanged ( )
virtual

Notifies a change of content type.

This event is triggered when the contentType() property changes.

Default Implementation

{
/* No default implementation */
}
virtual void contentTypeChanged()
Notifies a change of content type.

◆ layerChanged()

virtual void layerChanged ( )
virtual

Notified a c.

This event is triggered when the layer() property changes.

Default Implementation

{
}
virtual void layerChanged()
Notified a c.