libdisplaydevice master
C++ library to modify display devices.
mac_display_device_interface.h
Go to the documentation of this file.
1
5#pragma once
6
7// local includes
8#include "types.h"
9
10namespace display_device {
15 public:
19 virtual ~MacDisplayDeviceInterface() = default;
20
25 [[nodiscard]] virtual bool isApiAccessAvailable() const = 0;
26
31 [[nodiscard]] virtual EnumeratedDeviceList enumAvailableDevices() const = 0;
32
38 [[nodiscard]] virtual std::string getDisplayName(const std::string &device_id) const = 0;
39
44 [[nodiscard]] virtual MacActiveTopology getCurrentTopology() const = 0;
45
51 [[nodiscard]] virtual bool isTopologyValid(const MacActiveTopology &topology) const = 0;
52
59 [[nodiscard]] virtual bool isTopologyTheSame(const MacActiveTopology &lhs, const MacActiveTopology &rhs) const = 0;
60
66 [[nodiscard]] virtual bool setTopology(const MacActiveTopology &new_topology) = 0;
67
73 [[nodiscard]] virtual MacDeviceDisplayModeMap getCurrentDisplayModes(const StringSet &device_ids) const = 0;
74
80 [[nodiscard]] virtual bool setDisplayModes(const MacDeviceDisplayModeMap &modes) = 0;
81
87 [[nodiscard]] virtual bool isPrimary(const std::string &device_id) const = 0;
88
94 [[nodiscard]] virtual bool setAsPrimary(const std::string &device_id) = 0;
95
101 [[nodiscard]] virtual MacHdrStateMap getCurrentHdrStates(const StringSet &device_ids) const = 0;
102
108 [[nodiscard]] virtual bool setHdrStates(const MacHdrStateMap &states) = 0;
109 };
110} // namespace display_device
Higher level abstracted API for interacting with macOS display devices.
Definition mac_display_device_interface.h:14
virtual MacActiveTopology getCurrentTopology() const =0
Get the active topology.
virtual bool setTopology(const MacActiveTopology &new_topology)=0
Set a new active topology.
virtual bool isPrimary(const std::string &device_id) const =0
Check whether the specified device is primary.
virtual bool isTopologyValid(const MacActiveTopology &topology) const =0
Verify if the active topology is valid.
virtual EnumeratedDeviceList enumAvailableDevices() const =0
Enumerate the available display devices.
virtual bool setHdrStates(const MacHdrStateMap &states)=0
Set HDR states for the devices.
virtual bool setDisplayModes(const MacDeviceDisplayModeMap &modes)=0
Set new display modes for the devices.
virtual std::string getDisplayName(const std::string &device_id) const =0
Get the macOS capture selector associated with the device.
virtual MacHdrStateMap getCurrentHdrStates(const StringSet &device_ids) const =0
Get HDR state for the devices.
virtual ~MacDisplayDeviceInterface()=default
Default virtual destructor.
virtual MacDeviceDisplayModeMap getCurrentDisplayModes(const StringSet &device_ids) const =0
Get current display modes for the devices.
virtual bool isTopologyTheSame(const MacActiveTopology &lhs, const MacActiveTopology &rhs) const =0
Check if the topologies are close enough to be considered the same by macOS.
virtual bool setAsPrimary(const std::string &device_id)=0
Set the device as a primary display.
virtual bool isApiAccessAvailable() const =0
Check if the API for changing display settings is accessible.
std::vector< EnumeratedDevice > EnumeratedDeviceList
A list of EnumeratedDevice objects.
Definition types.h:208
std::set< std::string, std::less<> > StringSet
Ordered set keyed by strings with transparent comparisons.
Definition types.h:46
Declarations for macOS specific display device types.
StringMap< std::optional< HdrState > > MacHdrStateMap
Ordered map of [DEVICE_ID -> std::optional<HdrState>].
Definition types.h:87
StringMap< MacDisplayMode > MacDeviceDisplayModeMap
Ordered map of [DEVICE_ID -> MacDisplayMode].
Definition types.h:82
std::vector< std::vector< std::string > > MacActiveTopology
A LIST[LIST[DEVICE_ID]] structure which represents active macOS display topology.
Definition types.h:59