From bb50368d55eab508dc77e3cb0de9e2c5fd15ac7e Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Sun, 7 Jun 2015 14:35:12 +0200 Subject: [PATCH] Fixed enumeration of invalid video modes. Fixes #350. --- README.md | 1 + src/win32_monitor.c | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/README.md b/README.md index 14d7516b..174bbe83 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,7 @@ GLFW bundles a number of dependencies in the `deps/` directory. - Bugfix: The cached current context could get out of sync - [Win32] Renamed hybrid GPU override compile-time option to `_GLFW_USE_HYBRID_HPG` and added support for AMD PowerXpress systems + - [Win32] Bugfix: `glfwGetVideoModes` included unusable modes on some systems - [Cocoa] Bugfix: The cached `NSScreen` for a monitor could get out of sync - [Cocoa] Bugfix: The `GLFW_AUTO_ICONIFY` window hint was ignored - [Cocoa] Bugfix: Resizing a window to its minimum size would segfault diff --git a/src/win32_monitor.c b/src/win32_monitor.c index 19ecc146..be5686f8 100644 --- a/src/win32_monitor.c +++ b/src/win32_monitor.c @@ -226,6 +226,15 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* count) modeIndex++; + if (ChangeDisplaySettingsExW(monitor->win32.adapterName, + &dm, + NULL, + CDS_TEST, + NULL) != DISP_CHANGE_SUCCESSFUL) + { + continue; + } + // Skip modes with less than 15 BPP if (dm.dmBitsPerPel < 15) continue;