Louvre  v2.9.0-1
C++ library for Wayland compositors
Public Member Functions | List of all members
LClientCursor Class Referencefinal

Encapsulates parameters used in a set cursor request. More...

+ Inheritance diagram for LClientCursor:

Public Member Functions

bool visible () const noexcept
 Indicates if the client wants to hide the cursor. More...
 
const LPointerEnterEventtriggeringEvent () const noexcept
 Returns the pointer enter event sent to the client that initiated the cursor request. More...
 
LCursorRolecursorRole () const noexcept
 Returns the LCursorRole the client used for this cursor. More...
 
LClientclient () const noexcept
 Returns the client owning the cursor. 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...
 

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

Encapsulates parameters used in a set cursor request.

The LClientCursor class encapsulates the parameters requested by the client through LPointer::setCursorRequest().
You can retrieve the last cursor request for a specific client using LClient::lastCursorRequest().

Clients create an LCursorRole for the compositor to use as the cursor. This class holds a reference to the role along with the LPointerEnterEvent that triggered the request.
Additionally, it includes a property indicating whether the client intends to hide the cursor or not.
This information gets overridden when the same client makes another LPointer::setCursorRequest() or when the associated LCursorRole is destroyed.

When assigned to an LCursor through LCursor::setCursor(), the LCursor's texture and hotspot automatically change based on the values of the associated LCursorRole. However, the cursor size remains user-defined.
If the LCursorRole surface is unmapped or destroyed after being assigned to an LCursor, the default cursor is automatically restored.

Member Function Documentation

◆ visible()

bool visible ( ) const
inlinenoexcept

Indicates if the client wants to hide the cursor.

Returns true if the client has never made a set cursor request. If the LCursorRole is destroyed and this method returns true, and one of the client surfaces has pointer focus, then the default cursor should be restored.

Returns
true if the client intends to hide the cursor, false otherwise.

◆ triggeringEvent()

const LPointerEnterEvent& triggeringEvent ( ) const
inlinenoexcept

Returns the pointer enter event sent to the client that initiated the cursor request.

Returns
The triggering LPointerEnterEvent.

◆ cursorRole()

LCursorRole* cursorRole ( ) const
inlinenoexcept

Returns the LCursorRole the client used for this cursor.

If the user has never made a set cursor request or the LCursorRole was destroyed, this returns nullptr.

Returns
The associated LCursorRole or nullptr if no set cursor request has been made or the LCursorRole is destroyed.

◆ client()

LClient* client ( ) const
inlinenoexcept

Returns the client owning the cursor.

Returns
The associated LClient.