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

Token for activating surfaces. More...

+ Inheritance diagram for LActivationToken:

Public Member Functions

LClientcreator () const noexcept
 The client that requested the token creation. More...
 
LSurfaceorigin () const noexcept
 The surface of the client that created the token. More...
 
const LEventtriggeringEvent () const noexcept
 Triggering event. More...
 
UInt32 timesUsed () const noexcept
 Number of times the token has been used to activate a surface. More...
 
const std::chrono::time_point< std::chrono::steady_clock > & created () const noexcept
 Time the token was created. More...
 
const std::string & toActivateAppId () const noexcept
 The app ID of the client to be activated. More...
 
const std::string & token () const noexcept
 The unique and random token string generated by Louvre. More...
 
const std::unordered_map< std::string, LActivationToken * >::iterator destroy () const noexcept
 Invalidates and destroys the token. 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

Token for activating surfaces.

This class represents a token used in LActivationTokenManager::activateSurfaceRequest().

For more details, refer to the LActivationTokenManager class documentation.

Member Function Documentation

◆ creator()

LClient* creator ( ) const
inlinenoexcept

The client that requested the token creation.

Note
This may, but does not necessarily, refer to the same client that requests surface activation.
Returns
A valid pointer during LActivationTokenManager::createTokenRequest(), but it may return nullptr if accessed later, for example, if the client has disconnected.

◆ origin()

LSurface* origin ( ) const
inlinenoexcept

The surface of the client that created the token.

This refers to the surface where the triggeringEvent() was sent.

Note
This is different from the surface intended to be activated.
Warning
Clients are not obligated to provide this hint, so this method may return nullptr.

◆ triggeringEvent()

const LEvent* triggeringEvent ( ) const
inlinenoexcept

Triggering event.

Clients typically request token creation in response to an input event. The default implementation of LActivationTokenManager::createTokenRequest() only accepts requests containing a valid triggeringEvent().

See also
origin()
Warning
This value is optional, if the client does not specify a triggering event, this method returns nullptr.

◆ timesUsed()

UInt32 timesUsed ( ) const
inlinenoexcept

Number of times the token has been used to activate a surface.

Incremented by 1 before each LActivationTokenManager::activateSurfaceRequest().

◆ created()

const std::chrono::time_point<std::chrono::steady_clock>& created ( ) const
inlinenoexcept

Time the token was created.

See also
LActivationTokenManager::destroyTokensOlderThanMs().
Returns
The time point when the token was created.

◆ toActivateAppId()

const std::string& toActivateAppId ( ) const
inlinenoexcept

The app ID of the client to be activated.

This value is optional, if the token creator does not assign an app ID, this method returns an empty string.

◆ token()

const std::string& token ( ) const
inlinenoexcept

The unique and random token string generated by Louvre.

Returns
The token string.

◆ destroy()

const std::unordered_map< std::string, LActivationToken * >::iterator destroy ( ) const
noexcept

Invalidates and destroys the token.

Removes it from LActivationTokenManager::tokens().

Once destroyed, no client will be able to use it to activate surfaces.

Returns
An iterator to the next element in LActivationTokenManager::tokens().