mirror of
https://github.com/glfw/glfw.git
synced 2024-11-29 21:37:27 +00:00
parent
2fbb560eb7
commit
621ece63c8
@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
#include <IOKit/graphics/IOGraphicsLib.h>
|
#include <IOKit/graphics/IOGraphicsLib.h>
|
||||||
#include <CoreVideo/CVBase.h>
|
#include <CoreVideo/CVBase.h>
|
||||||
@ -148,7 +149,7 @@ static GLFWvidmode vidmodeFromCGDisplayMode(CGDisplayModeRef mode,
|
|||||||
GLFWvidmode result;
|
GLFWvidmode result;
|
||||||
result.width = (int) CGDisplayModeGetWidth(mode);
|
result.width = (int) CGDisplayModeGetWidth(mode);
|
||||||
result.height = (int) CGDisplayModeGetHeight(mode);
|
result.height = (int) CGDisplayModeGetHeight(mode);
|
||||||
result.refreshRate = (int) CGDisplayModeGetRefreshRate(mode);
|
result.refreshRate = (int) round(CGDisplayModeGetRefreshRate(mode));
|
||||||
|
|
||||||
if (result.refreshRate == 0)
|
if (result.refreshRate == 0)
|
||||||
{
|
{
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
|
||||||
static void outputHandleGeometry(void* data,
|
static void outputHandleGeometry(void* data,
|
||||||
@ -70,7 +71,7 @@ static void outputHandleMode(void* data,
|
|||||||
mode.redBits = 8;
|
mode.redBits = 8;
|
||||||
mode.greenBits = 8;
|
mode.greenBits = 8;
|
||||||
mode.blueBits = 8;
|
mode.blueBits = 8;
|
||||||
mode.refreshRate = refresh / 1000;
|
mode.refreshRate = (int) round(refresh / 1000.0);
|
||||||
|
|
||||||
monitor->modeCount++;
|
monitor->modeCount++;
|
||||||
monitor->modes =
|
monitor->modes =
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
|
||||||
// Check whether the display mode should be included in enumeration
|
// 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)
|
static int calculateRefreshRate(const XRRModeInfo* mi)
|
||||||
{
|
{
|
||||||
if (mi->hTotal && mi->vTotal)
|
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
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user