summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/video/win32_v.cpp31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp
index 7dfc0034a..9c5714786 100644
--- a/src/video/win32_v.cpp
+++ b/src/video/win32_v.cpp
@@ -914,24 +914,27 @@ void VideoDriver_Win32Base::EditBoxLostFocus()
SetCandidatePos(this->main_wnd);
}
-std::vector<int> VideoDriver_Win32Base::GetListOfMonitorRefreshRates()
+static BOOL CALLBACK MonitorEnumProc(HMONITOR hMonitor, HDC hDC, LPRECT rc, LPARAM data)
{
- std::vector<int> rates = {};
- EnumDisplayMonitors(nullptr, nullptr, [](HMONITOR hMonitor, HDC hDC, LPRECT rc, LPARAM data) -> BOOL {
- auto &list = *reinterpret_cast<std::vector<int>*>(data);
+ auto &list = *reinterpret_cast<std::vector<int>*>(data);
- MONITORINFOEX monitorInfo = {};
- monitorInfo.cbSize = sizeof(MONITORINFOEX);
- GetMonitorInfo(hMonitor, &monitorInfo);
+ MONITORINFOEX monitorInfo = {};
+ monitorInfo.cbSize = sizeof(MONITORINFOEX);
+ GetMonitorInfo(hMonitor, &monitorInfo);
- DEVMODE devMode = {};
- devMode.dmSize = sizeof(DEVMODE);
- devMode.dmDriverExtra = 0;
- EnumDisplaySettings(monitorInfo.szDevice, ENUM_CURRENT_SETTINGS, &devMode);
+ DEVMODE devMode = {};
+ devMode.dmSize = sizeof(DEVMODE);
+ devMode.dmDriverExtra = 0;
+ EnumDisplaySettings(monitorInfo.szDevice, ENUM_CURRENT_SETTINGS, &devMode);
+
+ if (devMode.dmDisplayFrequency != 0) list.push_back(devMode.dmDisplayFrequency);
+ return true;
+}
- if (devMode.dmDisplayFrequency != 0) list.push_back(devMode.dmDisplayFrequency);
- return true;
- }, reinterpret_cast<LPARAM>(&rates));
+std::vector<int> VideoDriver_Win32Base::GetListOfMonitorRefreshRates()
+{
+ std::vector<int> rates = {};
+ EnumDisplayMonitors(nullptr, nullptr, MonitorEnumProc, reinterpret_cast<LPARAM>(&rates));
return rates;
}