libdisplaydevice master
C++ library to modify display devices.
display_device::DisplayPowerInterface Class Referenceabstract

Cross-platform API for display wake and display-sleep prevention. More...

#include <src/common/include/display_device/display_power_interface.h>

Inheritance diagram for display_device::DisplayPowerInterface:
[legend]

Public Member Functions

virtual std::unique_ptr< DisplayPowerGuardInterfacekeepDisplayAwake (const std::string &reason)=0
 Keep displays awake until the returned guard is destroyed.
 
virtual bool wakeDisplay (const std::string &display_name, std::chrono::milliseconds timeout)=0
 Ask the platform to wake a display before detection or capture.
 
virtual ~DisplayPowerInterface ()=default
 Default virtual destructor.
 

Detailed Description

Cross-platform API for display wake and display-sleep prevention.

This API prepares displays for capture. It does not change display topology, primary display selection, resolution, refresh rate, HDR state, or any persisted display settings.

Member Function Documentation

◆ keepDisplayAwake()

virtual std::unique_ptr< DisplayPowerGuardInterface > display_device::DisplayPowerInterface::keepDisplayAwake ( const std::string & reason)
nodiscardpure virtual

Keep displays awake until the returned guard is destroyed.

Parameters
reasonShort human-readable reason for the platform power assertion.
Returns
A guard that owns the assertion, or nullptr if the assertion could not be created.

Implemented in display_device::MacDisplayPower, and display_device::WinDisplayPower.

◆ wakeDisplay()

virtual bool display_device::DisplayPowerInterface::wakeDisplay ( const std::string & display_name,
std::chrono::milliseconds timeout )
nodiscardpure virtual

Ask the platform to wake a display before detection or capture.

A successful result means the platform accepted the wake request and any platform-specific detection that this implementation can perform has passed. Some platforms cannot verify that the requested capture selector is awake, so callers should still retry their own capture-target enumeration after this method succeeds.

Parameters
display_namePlatform capture selector returned by SettingsManagerInterface::getDisplayName.
timeoutMaximum time to wait before the caller retries capture-target detection.
Returns
True if the wake request succeeded and platform-specific detection passed, false otherwise.

Implemented in display_device::MacDisplayPower, and display_device::WinDisplayPower.


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