libdisplaydevice latest
C++ library to modify display devices.
settings_utils.h
Go to the documentation of this file.
1
5#pragma once
6
7// system includes
8#include <chrono>
9#include <tuple>
10
11// local includes
12#include "types.h"
14
28 std::set<std::string> flattenTopology(const ActiveTopology &topology);
29
40
52 std::string getPrimaryDevice(WinDisplayDeviceInterface &win_dd, const ActiveTopology &topology);
53
68 std::optional<SingleDisplayConfigState::Initial> computeInitialState(const std::optional<SingleDisplayConfigState::Initial> &prev_state, const ActiveTopology &topology_before_changes, const EnumeratedDeviceList &devices);
69
76 std::optional<SingleDisplayConfigState::Initial> stripInitialState(const SingleDisplayConfigState::Initial &initial_state, const EnumeratedDeviceList &devices);
77
87 ActiveTopology computeNewTopology(SingleDisplayConfiguration::DevicePreparation device_prep, bool configuring_primary_devices, const std::string &device_to_configure, const std::set<std::string> &additional_devices_to_configure, const ActiveTopology &initial_topology);
88
96 std::tuple<ActiveTopology, std::string, std::set<std::string>> computeNewTopologyAndMetadata(SingleDisplayConfiguration::DevicePreparation device_prep, const std::string &device_id, const SingleDisplayConfigState::Initial &initial_state);
97
108 DeviceDisplayModeMap computeNewDisplayModes(const std::optional<Resolution> &resolution, const std::optional<FloatingPoint> &refresh_rate, bool configuring_primary_devices, const std::string &device_to_configure, const std::set<std::string> &additional_devices_to_configure, const DeviceDisplayModeMap &original_modes);
109
119 HdrStateMap computeNewHdrStates(const std::optional<HdrState> &hdr_state, bool configuring_primary_devices, const std::string &device_to_configure, const std::set<std::string> &additional_devices_to_configure, const HdrStateMap &original_states);
120
142 void blankHdrStates(WinDisplayDeviceInterface &win_dd, const std::optional<std::chrono::milliseconds> &delay);
143
155
167
181
193
206 DdGuardFn primaryGuardFn(WinDisplayDeviceInterface &win_dd, const std::string &primary_device);
207
219
233} // namespace display_device::win_utils
Higher level abstracted API for interacting Windows' display device(s).
Definition win_display_device_interface.h:17
std::vector< EnumeratedDevice > EnumeratedDeviceList
A list of EnumeratedDevice objects.
Definition types.h:124
Shared "utility-level" code for Settings.
Definition settings_utils.h:18
DdGuardFn hdrStateGuardFn(WinDisplayDeviceInterface &win_dd, const ActiveTopology &topology)
Make guard function for the HDR states.
Definition settings_utils.cpp:433
void blankHdrStates(WinDisplayDeviceInterface &win_dd, const std::optional< std::chrono::milliseconds > &delay)
Toggle enabled HDR states off and on again if quick succession.
Definition settings_utils.cpp:344
std::string getPrimaryDevice(WinDisplayDeviceInterface &win_dd, const ActiveTopology &topology)
Get one primary device from the provided topology.
Definition settings_utils.cpp:155
DeviceDisplayModeMap computeNewDisplayModes(const std::optional< Resolution > &resolution, const std::optional< FloatingPoint > &refresh_rate, bool configuring_primary_devices, const std::string &device_to_configure, const std::set< std::string > &additional_devices_to_configure, const DeviceDisplayModeMap &original_modes)
Compute new display modes from arbitrary data.
Definition settings_utils.cpp:268
std::tuple< ActiveTopology, std::string, std::set< std::string > > computeNewTopologyAndMetadata(SingleDisplayConfiguration::DevicePreparation device_prep, const std::string &device_id, const SingleDisplayConfigState::Initial &initial_state)
Compute new topology + metadata from config settings and initial state.
Definition settings_utils.cpp:252
DdGuardFn modeGuardFn(WinDisplayDeviceInterface &win_dd, const ActiveTopology &topology)
Make guard function for the display modes.
Definition settings_utils.cpp:403
DdGuardFn primaryGuardFn(WinDisplayDeviceInterface &win_dd, const ActiveTopology &topology)
Make guard function for the primary display.
Definition settings_utils.cpp:418
std::set< std::string > flattenTopology(const ActiveTopology &topology)
Get all the device ids in the topology.
Definition settings_utils.cpp:129
std::optional< SingleDisplayConfigState::Initial > computeInitialState(const std::optional< SingleDisplayConfigState::Initial > &prev_state, const ActiveTopology &topology_before_changes, const EnumeratedDeviceList &devices)
Compute the new intial state from arbitrary data.
Definition settings_utils.cpp:166
ActiveTopology createFullExtendedTopology(WinDisplayDeviceInterface &win_dd)
Create extended topology from all the available devices.
Definition settings_utils.cpp:140
HdrStateMap computeNewHdrStates(const std::optional< HdrState > &hdr_state, bool configuring_primary_devices, const std::string &device_to_configure, const std::set< std::string > &additional_devices_to_configure, const HdrStateMap &original_states)
Compute new HDR states from arbitrary data.
Definition settings_utils.cpp:313
std::optional< SingleDisplayConfigState::Initial > stripInitialState(const SingleDisplayConfigState::Initial &initial_state, const EnumeratedDeviceList &devices)
Strip the initial state of non-existing devices.
Definition settings_utils.cpp:220
ActiveTopology computeNewTopology(SingleDisplayConfiguration::DevicePreparation device_prep, bool configuring_primary_devices, const std::string &device_to_configure, const std::set< std::string > &additional_devices_to_configure, const ActiveTopology &initial_topology)
Compute new topology from arbitrary data.
Definition settings_utils.cpp:194
DdGuardFn topologyGuardFn(WinDisplayDeviceInterface &win_dd, const ActiveTopology &topology)
Make guard function for the topology.
Definition settings_utils.cpp:392
Data that represents the original system state and is used as a base when trying to re-apply settings...
Definition types.h:119
DevicePreparation
Enum detailing how to prepare the display device.
Definition types.h:136
Declarations for the WinDisplayDeviceInterface.
Declarations for Windows specific types.
std::map< std::string, std::optional< HdrState > > HdrStateMap
Ordered map of [DEVICE_ID -> std::optional<HdrState>].
Definition types.h:109
std::vector< std::vector< std::string > > ActiveTopology
A LIST[LIST[DEVICE_ID]] structure which represents an active topology.
Definition types.h:86
std::map< std::string, DisplayMode > DeviceDisplayModeMap
Ordered map of [DEVICE_ID -> DisplayMode].
Definition types.h:104
std::function< void()> DdGuardFn
Default function type used for cleanup/guard functions.
Definition types.h:169