Begun integrating mode setting and monitor API.

This commit is contained in:
Camilla Berglund
2013-01-02 17:29:24 +01:00
parent 1bc91bfe5b
commit 46c1e4028f
13 changed files with 138 additions and 217 deletions
+6 -4
View File
@@ -139,7 +139,7 @@ static GLFWvidmode vidmodeFromCGDisplayMode(CGDisplayModeRef mode)
// Change the current video mode
//========================================================================
GLboolean _glfwSetVideoMode(int* width, int* height, int* bpp)
GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, int* width, int* height, int* bpp)
{
CGDisplayModeRef bestMode = NULL;
CFArrayRef modes;
@@ -190,7 +190,7 @@ GLboolean _glfwSetVideoMode(int* width, int* height, int* bpp)
return GL_FALSE;
}
_glfw.ns.previousMode = CGDisplayCopyDisplayMode(CGMainDisplayID());
monitor->ns.previousMode = CGDisplayCopyDisplayMode(CGMainDisplayID());
CGDisplayCapture(CGMainDisplayID());
CGDisplaySetDisplayMode(CGMainDisplayID(), bestMode, NULL);
@@ -204,9 +204,9 @@ GLboolean _glfwSetVideoMode(int* width, int* height, int* bpp)
// Restore the previously saved (original) video mode
//========================================================================
void _glfwRestoreVideoMode(void)
void _glfwRestoreVideoMode(_GLFWmonitor* monitor)
{
CGDisplaySetDisplayMode(CGMainDisplayID(), _glfw.ns.previousMode, NULL);
CGDisplaySetDisplayMode(CGMainDisplayID(), monitor->ns.previousMode, NULL);
CGDisplayRelease(CGMainDisplayID());
}
@@ -236,6 +236,8 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
return NULL;
}
CGGetActiveDisplayList(monitorCount, displays, &monitorCount);
monitors = (_GLFWmonitor**) calloc(monitorCount, sizeof(_GLFWmonitor*));
if (!monitors)
{