libdisplaydevice master
C++ library to modify display devices.
display_device::MacDisplayDevice Class Reference

Default implementation for the MacDisplayDeviceInterface. More...

#include <src/macos/include/display_device/macos/mac_display_device.h>

Inheritance diagram for display_device::MacDisplayDevice:
[legend]
Collaboration diagram for display_device::MacDisplayDevice:
[legend]

Public Member Functions

EnumeratedDeviceList enumAvailableDevices () const override
 Enumerate the available display devices.
 
MacDeviceDisplayModeMap getCurrentDisplayModes (const StringSet &device_ids) const override
 Get current display modes for the devices.
 
MacHdrStateMap getCurrentHdrStates (const StringSet &device_ids) const override
 Get HDR state for the devices.
 
MacActiveTopology getCurrentTopology () const override
 Get the active topology.
 
std::string getDisplayName (const std::string &device_id) const override
 Get the macOS capture selector associated with the device.
 
bool isApiAccessAvailable () const override
 Check if the API for changing display settings is accessible.
 
bool isPrimary (const std::string &device_id) const override
 Check whether the specified device is primary.
 
bool isTopologyTheSame (const MacActiveTopology &lhs, const MacActiveTopology &rhs) const override
 Check if the topologies are close enough to be considered the same by macOS.
 
bool isTopologyValid (const MacActiveTopology &topology) const override
 Verify if the active topology is valid.
 
 MacDisplayDevice (std::shared_ptr< MacApiLayerInterface > m_api)
 Default constructor for the class.
 
bool setAsPrimary (const std::string &device_id) override
 Set the device as a primary display.
 
bool setDisplayModes (const MacDeviceDisplayModeMap &modes) override
 Set new display modes for the devices.
 
bool setHdrStates (const MacHdrStateMap &states) override
 Set HDR states for the devices.
 
bool setTopology (const MacActiveTopology &new_topology) override
 Set a new active topology.
 
- Public Member Functions inherited from display_device::MacDisplayDeviceInterface
virtual ~MacDisplayDeviceInterface ()=default
 Default virtual destructor.
 

Detailed Description

Default implementation for the MacDisplayDeviceInterface.

Constructor & Destructor Documentation

◆ MacDisplayDevice()

display_device::MacDisplayDevice::MacDisplayDevice ( std::shared_ptr< MacApiLayerInterface > m_api)
explicit

Default constructor for the class.

Parameters
m_apiA pointer to the macOS API layer. Will throw on nullptr.

Member Function Documentation

◆ enumAvailableDevices()

EnumeratedDeviceList display_device::MacDisplayDevice::enumAvailableDevices ( ) const
nodiscardoverridevirtual

Enumerate the available display devices.

Returns
A list of available devices. Empty list can also indicate an error.

Implements display_device::MacDisplayDeviceInterface.

◆ getCurrentDisplayModes()

MacDeviceDisplayModeMap display_device::MacDisplayDevice::getCurrentDisplayModes ( const StringSet & device_ids) const
nodiscardoverridevirtual

Get current display modes for the devices.

Parameters
device_idsDevices to get modes for.
Returns
Display mode map, or an empty map if unavailable.

Implements display_device::MacDisplayDeviceInterface.

◆ getCurrentHdrStates()

MacHdrStateMap display_device::MacDisplayDevice::getCurrentHdrStates ( const StringSet & device_ids) const
nodiscardoverridevirtual

Get HDR state for the devices.

Parameters
device_idsDevices to get HDR states for.
Returns
HDR states per device, or an empty map if unavailable.

Implements display_device::MacDisplayDeviceInterface.

◆ getCurrentTopology()

MacActiveTopology display_device::MacDisplayDevice::getCurrentTopology ( ) const
nodiscardoverridevirtual

Get the active topology.

Returns
Active topology, or an empty topology if unavailable.

Implements display_device::MacDisplayDeviceInterface.

◆ getDisplayName()

std::string display_device::MacDisplayDevice::getDisplayName ( const std::string & device_id) const
nodiscardoverridevirtual

Get the macOS capture selector associated with the device.

Parameters
device_idA device to get display name for.
Returns
Decimal CoreGraphics display id string, or an empty string if not found.

Implements display_device::MacDisplayDeviceInterface.

◆ isApiAccessAvailable()

bool display_device::MacDisplayDevice::isApiAccessAvailable ( ) const
nodiscardoverridevirtual

Check if the API for changing display settings is accessible.

Returns
True if display settings can be changed, false otherwise.

Implements display_device::MacDisplayDeviceInterface.

◆ isPrimary()

bool display_device::MacDisplayDevice::isPrimary ( const std::string & device_id) const
nodiscardoverridevirtual

Check whether the specified device is primary.

Parameters
device_idDevice to perform the check for.
Returns
True if the device is primary, false otherwise.

Implements display_device::MacDisplayDeviceInterface.

◆ isTopologyTheSame()

bool display_device::MacDisplayDevice::isTopologyTheSame ( const MacActiveTopology & lhs,
const MacActiveTopology & rhs ) const
nodiscardoverridevirtual

Check if the topologies are close enough to be considered the same by macOS.

Parameters
lhsFirst topology to compare.
rhsSecond topology to compare.
Returns
True if topologies are the same, false otherwise.

Implements display_device::MacDisplayDeviceInterface.

◆ isTopologyValid()

bool display_device::MacDisplayDevice::isTopologyValid ( const MacActiveTopology & topology) const
nodiscardoverridevirtual

Verify if the active topology is valid.

Parameters
topologyTopology to validate.
Returns
True if valid, false otherwise.

Implements display_device::MacDisplayDeviceInterface.

◆ setAsPrimary()

bool display_device::MacDisplayDevice::setAsPrimary ( const std::string & device_id)
nodiscardoverridevirtual

Set the device as a primary display.

Parameters
device_idDevice to set as primary.
Returns
True if the device is or was set as primary, false otherwise.

Implements display_device::MacDisplayDeviceInterface.

◆ setDisplayModes()

bool display_device::MacDisplayDevice::setDisplayModes ( const MacDeviceDisplayModeMap & modes)
nodiscardoverridevirtual

Set new display modes for the devices.

Parameters
modesModes to set.
Returns
True if modes were set, false otherwise.

Implements display_device::MacDisplayDeviceInterface.

◆ setHdrStates()

bool display_device::MacDisplayDevice::setHdrStates ( const MacHdrStateMap & states)
nodiscardoverridevirtual

Set HDR states for the devices.

Parameters
statesHDR states to set.
Returns
True if HDR states were set or no changes were needed, false otherwise.

Implements display_device::MacDisplayDeviceInterface.

◆ setTopology()

bool display_device::MacDisplayDevice::setTopology ( const MacActiveTopology & new_topology)
nodiscardoverridevirtual

Set a new active topology.

Parameters
new_topologyNew topology to set.
Returns
True if the new topology has been set, false otherwise.

Implements display_device::MacDisplayDeviceInterface.


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