Commit 3fe63a3
committed
dispserv_win32: define _WIN32_WINNT before including Windows headers
Fixes "Set Display-Reported Refresh Rate" reporting 0.000 Hz on Windows
nightly builds (compiled with MinGW/GCC 10.2.0) while working correctly
on builds compiled with newer toolchains (MinGW/GCC 15.2.0).
win32_display_server_get_refresh_rate() guards its QueryDisplayConfig
implementation with `#if _WIN32_WINNT >= 0x0601`, falling back to
`return 0.0f` otherwise. The file already attempted to define
_WIN32_WINNT to 0x0601 when undefined, but the fallback #define was
placed *after* <objbase.h>, <initguid.h>, <windows.h>, <ntverp.h> and
<shlobj.h>, by which point the SDK headers had already locked in the
toolchain's default value. Older mingw-w64 runtimes default to a value
below 0x0601 when the build system does not specify one, so the
function was compiled to unconditionally return 0.0f. Newer mingw-w64
runtimes default to 0x0A00, which is why the issue did not reproduce
locally.
Move the _WIN32_WINNT (and _WIN32_WINDOWS) fallback defines to the top
of the translation unit, before any Windows headers are included, so
the version gate is honored regardless of toolchain.1 parent 7c7bf59 commit 3fe63a3
1 file changed
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
20 | 29 | | |
21 | 30 | | |
22 | 31 | | |
| |||
0 commit comments