summaryrefslogtreecommitdiff
path: root/src/video
diff options
context:
space:
mode:
authorglx22 <glx@openttd.org>2021-05-13 23:47:08 +0200
committerLoïc Guilloux <glx22@users.noreply.github.com>2021-06-10 23:17:29 +0200
commit2df48a78ccf617da3c1b4304353a59adbe51b431 (patch)
tree60f672ae59dfb0dd645500254dd813ac021451c6 /src/video
parent3ca023998574548fee50ad4c42e0b0996b9f0919 (diff)
downloadopenttd-2df48a78ccf617da3c1b4304353a59adbe51b431.tar.xz
Fix: [MinGW32] Can't convert lambda to stdcall
Diffstat (limited to 'src/video')
-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;
}