mirror of
https://github.com/glfw/glfw.git
synced 2025-12-16 20:23:13 +00:00
Merge 74c2ca04d7 into dbadda2683
This commit is contained in:
commit
160422b142
@ -314,6 +314,7 @@ void _glfwPollMonitorsCocoa(void)
|
|||||||
_glfw.monitorCount * sizeof(_GLFWmonitor*));
|
_glfw.monitorCount * sizeof(_GLFWmonitor*));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NSArray* screens = [NSScreen screens];
|
||||||
for (uint32_t i = 0; i < displayCount; i++)
|
for (uint32_t i = 0; i < displayCount; i++)
|
||||||
{
|
{
|
||||||
if (CGDisplayIsAsleep(displays[i]))
|
if (CGDisplayIsAsleep(displays[i]))
|
||||||
@ -322,7 +323,7 @@ void _glfwPollMonitorsCocoa(void)
|
|||||||
const uint32_t unitNumber = CGDisplayUnitNumber(displays[i]);
|
const uint32_t unitNumber = CGDisplayUnitNumber(displays[i]);
|
||||||
NSScreen* screen = nil;
|
NSScreen* screen = nil;
|
||||||
|
|
||||||
for (screen in [NSScreen screens])
|
for (screen in screens)
|
||||||
{
|
{
|
||||||
NSNumber* screenNumber = [screen deviceDescription][@"NSScreenNumber"];
|
NSNumber* screenNumber = [screen deviceDescription][@"NSScreenNumber"];
|
||||||
|
|
||||||
@ -332,6 +333,9 @@ void _glfwPollMonitorsCocoa(void)
|
|||||||
if (CGDisplayUnitNumber([screenNumber unsignedIntValue]) == unitNumber)
|
if (CGDisplayUnitNumber([screenNumber unsignedIntValue]) == unitNumber)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// fallback: when displays are in mirroring mode, only one NSScreen exists
|
||||||
|
if(screen == nil)
|
||||||
|
screen = [[NSScreen screens] firstObject];
|
||||||
|
|
||||||
// HACK: Compare unit numbers instead of display IDs to work around
|
// HACK: Compare unit numbers instead of display IDs to work around
|
||||||
// display replacement on machines with automatic graphics
|
// display replacement on machines with automatic graphics
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user