diff --git a/glfw/cocoa_monitor.m b/glfw/cocoa_monitor.m index d53588fd6..6a8ff0d67 100644 --- a/glfw/cocoa_monitor.m +++ b/glfw/cocoa_monitor.m @@ -29,6 +29,7 @@ #include #include +#include #include #include @@ -148,7 +149,7 @@ static GLFWvidmode vidmodeFromCGDisplayMode(CGDisplayModeRef mode, GLFWvidmode result; result.width = (int) CGDisplayModeGetWidth(mode); result.height = (int) CGDisplayModeGetHeight(mode); - result.refreshRate = (int) CGDisplayModeGetRefreshRate(mode); + result.refreshRate = (int) round(CGDisplayModeGetRefreshRate(mode)); if (result.refreshRate == 0) { diff --git a/glfw/wl_monitor.c b/glfw/wl_monitor.c index c1923f378..8d50637da 100644 --- a/glfw/wl_monitor.c +++ b/glfw/wl_monitor.c @@ -30,6 +30,7 @@ #include #include #include +#include static void outputHandleGeometry(void* data, @@ -70,7 +71,7 @@ static void outputHandleMode(void* data, mode.redBits = 8; mode.greenBits = 8; mode.blueBits = 8; - mode.refreshRate = refresh / 1000; + mode.refreshRate = (int)round(refresh / 1000.0); monitor->modeCount++; monitor->modes = diff --git a/glfw/x11_monitor.c b/glfw/x11_monitor.c index d5490ee14..17b3812cc 100644 --- a/glfw/x11_monitor.c +++ b/glfw/x11_monitor.c @@ -30,6 +30,7 @@ #include #include #include +#include // Check whether the display mode should be included in enumeration @@ -44,7 +45,7 @@ static GLFWbool modeIsGood(const XRRModeInfo* mi) static int calculateRefreshRate(const XRRModeInfo* mi) { if (mi->hTotal && mi->vTotal) - return (int) ((double) mi->dotClock / ((double) mi->hTotal * (double) mi->vTotal)); + return (int) round((double) mi->dotClock / ((double) mi->hTotal * (double) mi->vTotal)); else return 0; }