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

Idle state listener. More...

+ Inheritance diagram for LIdleListener:

Public Member Functions

void resetTimer () const noexcept
 Resets the internal timer. More...
 
UInt32 timeout () const noexcept
 The timeout in milliseconds. More...
 
LClientclient () const noexcept
 Client owner of the listener. More...
 
const Protocols::IdleNotify::RIdleNotification & resource () const noexcept
 Associated Wayland resource. 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

Idle state listener.

Clients using the Idle Notify protocol create an instance of this class to be notified when the user has been idle for a set amount of time. For example, swayidle uses this information to trigger screen lockers, screen savers, etc.

Note
All idle listeners can be accessed from LSeat::idleListeners().

Each listener has its own timer with a fixed timeout() in milliseconds, defined by the client(). The timer should be reset with resetTimer() whenever a user event occurs (see LSeat::onEvent()).

If there is no user activity and the timeout() is reached, LSeat::onIdleListenerTimeout() is triggered.

Note
Resetting all timers each time an event occurs isn't very CPU-friendly. Consider using LSeat::setIsUserIdleHint() instead like the default LSeat::onEvent() implementation does.

Idle Inhibitors

Clients using the Idle Inhibit protocol can request to prevent the idle state if one of their surfaces is mapped and visible.

These surfaces can be accessed from LSeat::idleInhibitorSurfaces().

The auxiliary virtual method LSeat::isIdleStateInhibited() is used by the default implementation of LSeat::onIdleListenerTimeout() to check if the timer should be reset.

Member Function Documentation

◆ resetTimer()

void resetTimer ( ) const
noexcept

Resets the internal timer.

This method should be called each time an event indicating user activity occurs (see LSeat::onEvent()). When the timeout() is reached, LSeat::onIdleListenerTimeout() is triggered.

◆ timeout()

UInt32 timeout ( ) const
noexcept

The timeout in milliseconds.

◆ client()

LClient * client ( ) const
noexcept

Client owner of the listener.

◆ resource()

const Protocols::IdleNotify::RIdleNotification& resource ( ) const
inlinenoexcept

Associated Wayland resource.