diff --git a/AdaptiveBrightness/monitor.hpp b/AdaptiveBrightness/monitor.hpp index 828f8b0..57cf27f 100644 --- a/AdaptiveBrightness/monitor.hpp +++ b/AdaptiveBrightness/monitor.hpp @@ -2,6 +2,7 @@ #ifdef _MSC_VER + #include #include #include @@ -18,12 +19,19 @@ class Monitor { Monitor() = delete; private: + struct PhysicalMonitor { + PhysicalMonitor(HANDLE handle, const WCHAR* name) : handle(handle), name(name) {} + + HANDLE handle; + std::wstring name; + }; + friend BOOL detail::enumMonitorsCallback(HMONITOR, HDC, LPRECT, LPARAM); - Monitor(HMONITOR hMonitor, PHYSICAL_MONITOR hPhysicalMonitor); + Monitor(HMONITOR hMonitor, PHYSICAL_MONITOR physicalMonitor); const HMONITOR m_hMonitor; - const PHYSICAL_MONITOR m_physicalMonitor; + const PhysicalMonitor m_physicalMonitor; }; #endif diff --git a/AdaptiveBrightness/monitor_win.cpp b/AdaptiveBrightness/monitor_win.cpp index 3383f9e..91a9d2c 100644 --- a/AdaptiveBrightness/monitor_win.cpp +++ b/AdaptiveBrightness/monitor_win.cpp @@ -2,6 +2,10 @@ #ifdef _MSC_VER -Monitor::Monitor(HMONITOR hMonitor, PHYSICAL_MONITOR hPhysicalMonitor) : m_hMonitor(hMonitor), m_physicalMonitor(m_physicalMonitor) {} +Monitor::Monitor(HMONITOR hMonitor, PHYSICAL_MONITOR physicalMonitor) + : m_hMonitor(hMonitor) + , m_physicalMonitor(physicalMonitor.hPhysicalMonitor, physicalMonitor.szPhysicalMonitorDescription) +{ +} #endif