Cocoa: Ignore monitors which are mirroring another

Currently monitors which are mirroring another one are returned by
`glfwGetMonitors` but their `ns.screen` is `NULL`. Some functions like
`glfwGetMonitorContentScale` and `glfwGetMonitorWorkarea` assert that
`ns.screen` is not `NULL`. Since mirrored monitors are logically the
same we should only consider the primary monitor and ignore the
non-primary ones.
This commit is contained in:
Max Thrun 2022-10-28 23:39:29 -07:00
parent 3eaf1255b2
commit 8fcf59f883

View File

@ -320,6 +320,9 @@ void _glfwPollMonitorsCocoa(void)
if (CGDisplayIsAsleep(displays[i])) if (CGDisplayIsAsleep(displays[i]))
continue; continue;
if (CGDisplayMirrorsDisplay(displays[i]) != kCGNullDirectDisplay)
continue;
const uint32_t unitNumber = CGDisplayUnitNumber(displays[i]); const uint32_t unitNumber = CGDisplayUnitNumber(displays[i]);
NSScreen* screen = nil; NSScreen* screen = nil;