Cocoa: Fix duplicate monitor connection events

This commit is contained in:
Camilla Löwy 2021-01-18 01:26:00 +01:00
parent 8b11867464
commit 5aff72aa00

View File

@ -338,7 +338,8 @@ void _glfwPollMonitorsNS(void)
// display replacement on machines with automatic graphics
// switching
const uint32_t unitNumber = CGDisplayUnitNumber(displays[i]);
for (uint32_t j = 0; j < disconnectedCount; j++)
uint32_t j;
for (j = 0; j < disconnectedCount; j++)
{
if (disconnected[j] && disconnected[j]->ns.unitNumber == unitNumber)
{
@ -347,6 +348,9 @@ void _glfwPollMonitorsNS(void)
}
}
if (j < disconnectedCount)
continue;
const CGSize size = CGDisplayScreenSize(displays[i]);
char* name = getDisplayName(displays[i]);
if (!name)