Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
PhosphorCompositor::DebouncedScreenAction Class Reference

Compositor-agnostic debounced action with coalescing. More...

#include <phosphor-compositor/include/PhosphorCompositor/DebouncedAction.h>

Inheritance diagram for PhosphorCompositor::DebouncedScreenAction:
[legend]

Signals

void applyRequested ()
 Emitted when an apply is requested (debounced change or explicit reapply)
 

Public Member Functions

 DebouncedScreenAction (int debounceMs, QObject *parent=nullptr)
 
void stop ()
 
void geometryChanged (const QRect &currentGeometry)
 Signal that the screen geometry has changed.
 
void requestReapply ()
 Request a re-apply (e.g., daemon-triggered).
 
void markApplyStarted ()
 Call when the apply operation starts (before async D-Bus call).
 
void markApplyCompleted ()
 Call when the apply operation completes.
 
bool isChangeInProgress () const
 
void setLastGeometry (const QRect &geo)
 

Detailed Description

Compositor-agnostic debounced action with coalescing.

Debounces rapid-fire geometry change signals (e.g., screen connect/disconnect) and coalesces re-apply requests while a previous apply is in progress.

Shared by Wayfire plugin and future compositor integrations. KWin's ScreenChangeHandler has its own specialized debounce logic that also checks virtual screen SIZE (not just geometry) before triggering.

Note: geometryChanged() only detects actual geometry changes. If a monitor disconnects and reconnects at the same resolution, the geometry is unchanged and no action is triggered. Callers needing screen-count-change detection should handle that separately.

Note
Thread safety: All methods must be called from the QObject's owning thread (typically the compositor's main thread). QTimer requires an event loop on the owning thread. Do not call from worker threads.

Constructor & Destructor Documentation

◆ DebouncedScreenAction()

PhosphorCompositor::DebouncedScreenAction::DebouncedScreenAction ( int  debounceMs,
QObject *  parent = nullptr 
)
inlineexplicit
Parameters
debounceMsDebounce interval in milliseconds
parentQObject parent for timer ownership

Member Function Documentation

◆ applyRequested

void PhosphorCompositor::DebouncedScreenAction::applyRequested ( )
signal

Emitted when an apply is requested (debounced change or explicit reapply)

◆ geometryChanged()

void PhosphorCompositor::DebouncedScreenAction::geometryChanged ( const QRect &  currentGeometry)
inline

Signal that the screen geometry has changed.

Debounces and only triggers the action when geometry actually changes size.

Parameters
currentGeometryCurrent virtual screen geometry

◆ isChangeInProgress()

bool PhosphorCompositor::DebouncedScreenAction::isChangeInProgress ( ) const
inline

◆ markApplyCompleted()

void PhosphorCompositor::DebouncedScreenAction::markApplyCompleted ( )
inline

Call when the apply operation completes.

Triggers re-apply if one was coalesced.

◆ markApplyStarted()

void PhosphorCompositor::DebouncedScreenAction::markApplyStarted ( )
inline

Call when the apply operation starts (before async D-Bus call).

◆ requestReapply()

void PhosphorCompositor::DebouncedScreenAction::requestReapply ( )
inline

Request a re-apply (e.g., daemon-triggered).

Coalesces if an apply is already in progress.

◆ setLastGeometry()

void PhosphorCompositor::DebouncedScreenAction::setLastGeometry ( const QRect &  geo)
inline

◆ stop()

void PhosphorCompositor::DebouncedScreenAction::stop ( )
inline

The documentation for this class was generated from the following file: