Added initial NSScreen integration.

This (tentatively) fixes the bug of full screen windows on OS X always
opening on the primary monitor.
This commit is contained in:
Camilla Berglund
2013-04-17 23:07:44 +02:00
parent 130f07d8c3
commit 57751a5494
7 changed files with 42 additions and 15 deletions
+29
View File
@@ -272,6 +272,35 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
}
}
NSArray* screens = [NSScreen screens];
for (i = 0; i < monitorCount; i++)
{
int j;
for (j = 0; j < [screens count]; j++)
{
NSScreen* screen = [screens objectAtIndex:j];
NSDictionary* dictionary = [screen deviceDescription];
NSNumber* number = [dictionary objectForKey:@"NSScreenNumber"];
if (monitors[i]->ns.displayID == [number unsignedIntegerValue])
{
monitors[i]->ns.screen = screen;
break;
}
}
if (monitors[i]->ns.screen == nil)
{
_glfwDestroyMonitors(monitors, monitorCount);
_glfwInputError(GLFW_PLATFORM_ERROR,
"Cocoa: Failed to find NSScreen for CGDisplay %s",
monitors[i]->name);
return NULL;
}
}
*count = monitorCount;
return monitors;
}