libdisplaydevice latest
C++ library to modify display devices.
win_api_layer_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 ~WinApiLayerInterface() = default;
20
30 [[nodiscard]] virtual std::string getErrorString(LONG error_code) const = 0;
31
41 [[nodiscard]] virtual std::optional<PathAndModeData> queryDisplayConfig(QueryType type) const = 0;
42
85 [[nodiscard]] virtual std::string getDeviceId(const DISPLAYCONFIG_PATH_INFO &path) const = 0;
86
92 [[nodiscard]] virtual std::vector<std::byte> getEdid(const DISPLAYCONFIG_PATH_INFO &path) const = 0;
93
108 [[nodiscard]] virtual std::string getMonitorDevicePath(const DISPLAYCONFIG_PATH_INFO &path) const = 0;
109
122 [[nodiscard]] virtual std::string getFriendlyName(const DISPLAYCONFIG_PATH_INFO &path) const = 0;
123
141 [[nodiscard]] virtual std::string getDisplayName(const DISPLAYCONFIG_PATH_INFO &path) const = 0;
142
158 [[nodiscard]] virtual LONG setDisplayConfig(std::vector<DISPLAYCONFIG_PATH_INFO> paths, std::vector<DISPLAYCONFIG_MODE_INFO> modes, UINT32 flags) = 0;
159
170 [[nodiscard]] virtual std::optional<HdrState> getHdrState(const DISPLAYCONFIG_PATH_INFO &path) const = 0;
171
183 [[nodiscard]] virtual bool setHdrState(const DISPLAYCONFIG_PATH_INFO &path, HdrState state) = 0;
184
198 [[nodiscard]] virtual std::optional<Rational> getDisplayScale(const std::string &display_name, const DISPLAYCONFIG_SOURCE_MODE &source_mode) const = 0;
199 };
200} // namespace display_device
Lowest level Windows API wrapper for easy mocking.
Definition win_api_layer_interface.h:14
virtual std::string getDisplayName(const DISPLAYCONFIG_PATH_INFO &path) const =0
Get the logical display name for the path.
virtual LONG setDisplayConfig(std::vector< DISPLAYCONFIG_PATH_INFO > paths, std::vector< DISPLAYCONFIG_MODE_INFO > modes, UINT32 flags)=0
Direct wrapper around the SetDisplayConfig WinAPI.
virtual ~WinApiLayerInterface()=default
Default virtual destructor.
virtual std::string getDeviceId(const DISPLAYCONFIG_PATH_INFO &path) const =0
Get a stable and persistent device id for the path.
virtual bool setHdrState(const DISPLAYCONFIG_PATH_INFO &path, HdrState state)=0
Set the HDR state for the path.
virtual std::string getMonitorDevicePath(const DISPLAYCONFIG_PATH_INFO &path) const =0
Get a string that represents a path from the adapter to the display target.
virtual std::vector< std::byte > getEdid(const DISPLAYCONFIG_PATH_INFO &path) const =0
Get EDID byte array for the path.
virtual std::optional< Rational > getDisplayScale(const std::string &display_name, const DISPLAYCONFIG_SOURCE_MODE &source_mode) const =0
Get the scaling value for the display.
virtual std::string getFriendlyName(const DISPLAYCONFIG_PATH_INFO &path) const =0
Get the user-friendly name for the path.
virtual std::optional< PathAndModeData > queryDisplayConfig(QueryType type) const =0
Query Windows for the device paths and associated modes.
virtual std::string getErrorString(LONG error_code) const =0
Stringify the error code from Windows API.
virtual std::optional< HdrState > getHdrState(const DISPLAYCONFIG_PATH_INFO &path) const =0
Get the HDR state the path.
HdrState
The device's HDR state in the operating system.
Definition types.h:18
Declarations for Windows specific types.
QueryType
Type of query the OS should perform while searching for display devices.
Definition types.h:26