+
+/** Get the refresh rate for the monitor, in Hz */
+static int
+get_refresh_rate(void)
+{
+ DEVMODE devModes;
+
+ if (EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &devModes)) {
+ /* clamp the value, just in case we get garbage */
+ return CLAMP(devModes.dmDisplayFrequency, 30, 120);
+ }
+ else {
+ /* reasonable default */
+ return 60;
+ }