Enabled enumeration of mirroring displays.

This exposes all monitors in every mirroring group, which is needed for
robust detection of an Oculus Rift.
This commit is contained in:
Camilla Berglund
2014-09-12 17:00:05 +02:00
parent 8fd69bc6c2
commit 1b6d8a6ed6
5 changed files with 101 additions and 123 deletions
+11 -3
View File
@@ -252,18 +252,26 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
*count = 0;
CGGetActiveDisplayList(0, NULL, &displayCount);
CGGetOnlineDisplayList(0, NULL, &displayCount);
displays = calloc(displayCount, sizeof(CGDirectDisplayID));
monitors = calloc(displayCount, sizeof(_GLFWmonitor*));
CGGetActiveDisplayList(displayCount, displays, &displayCount);
CGGetOnlineDisplayList(displayCount, displays, &displayCount);
NSArray* screens = [NSScreen screens];
for (i = 0; i < displayCount; i++)
{
int j;
if (CGDisplayIsAsleep(displays[i]))
continue;
CGDirectDisplayID screenDisplayID = CGDisplayMirrorsDisplay(displays[i]);
if (screenDisplayID == kCGNullDirectDisplay)
screenDisplayID = displays[i];
const CGSize size = CGDisplayScreenSize(displays[i]);
char* name = getDisplayName(displays[i]);
@@ -278,7 +286,7 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
NSDictionary* dictionary = [screen deviceDescription];
NSNumber* number = [dictionary objectForKey:@"NSScreenNumber"];
if (monitors[found]->ns.displayID == [number unsignedIntegerValue])
if ([number unsignedIntegerValue] == screenDisplayID)
{
monitors[found]->ns.screen = screen;
break;