Skip to content

Commit

Permalink
Took updated M1 code from current GLFW
Browse files Browse the repository at this point in the history
(NOT A FULL MERGE)
  • Loading branch information
mathucub committed Jun 29, 2022
1 parent 3de91d6 commit e25634c
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/cocoa_monitor.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,20 @@
{
NSString* name = [screen valueForKey:@"localizedName"];
if (name)
return _glfw_strdup([name UTF8String]);
return strdup([name UTF8String]);
}
}

io_iterator_t it;
io_service_t service;
CFDictionaryRef info;

if (IOServiceGetMatchingServices(kIOMasterPortDefault,
if (IOServiceGetMatchingServices(MACH_PORT_NULL,
IOServiceMatching("IODisplayConnect"),
&it) != 0)
{
// This may happen if a desktop Mac is running headless
return NULL;
return strdup("Display");
}

while ((service = IOIteratorNext(it)) != 0)
Expand Down Expand Up @@ -97,11 +98,7 @@
IOObjectRelease(it);

if (!service)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Cocoa: Failed to find service port for display");
return NULL;
}
return strdup("Display");

CFDictionaryRef names =
CFDictionaryGetValue(info, CFSTR(kDisplayProductName));
Expand All @@ -113,7 +110,7 @@
{
// This may happen if a desktop Mac is running headless
CFRelease(info);
return NULL;
return strdup("Display");
}

const CFIndex size =
Expand All @@ -126,7 +123,6 @@
return name;
}


// Check whether the display mode should be included in enumeration
//
static GLFWbool modeIsGood(CGDisplayModeRef mode)
Expand Down

0 comments on commit e25634c

Please sign in to comment.