mirror of
https://github.com/glfw/glfw.git
synced 2026-09-18 22:55:46 +00:00
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:
+11
-3
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user