From 219bf564f7dc354b459da869ecf07b90c5624fba Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 13 Jun 2021 09:07:08 +0530 Subject: [PATCH] Fix #3719 --- glfw/cocoa_monitor.m | 4 ++-- glfw/cocoa_platform.h | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/glfw/cocoa_monitor.m b/glfw/cocoa_monitor.m index a9dd86117..e81a35fd4 100644 --- a/glfw/cocoa_monitor.m +++ b/glfw/cocoa_monitor.m @@ -47,7 +47,7 @@ static char* getDisplayName(CGDirectDisplayID displayID) io_service_t service; CFDictionaryRef info; - if (IOServiceGetMatchingServices(kIOMasterPortDefault, + if (IOServiceGetMatchingServices(kIOMainPortDefault, IOServiceMatching("IODisplayConnect"), &it) != 0) { @@ -245,7 +245,7 @@ static double getFallbackRefreshRate(CGDirectDisplayID displayID) io_iterator_t it; io_service_t service; - if (IOServiceGetMatchingServices(kIOMasterPortDefault, + if (IOServiceGetMatchingServices(kIOMainPortDefault, IOServiceMatching("IOFramebuffer"), &it) != 0) { diff --git a/glfw/cocoa_platform.h b/glfw/cocoa_platform.h index 67290e128..9533c9589 100644 --- a/glfw/cocoa_platform.h +++ b/glfw/cocoa_platform.h @@ -39,6 +39,9 @@ typedef void* CVDisplayLinkRef; // NOTE: Many Cocoa enum values have been renamed and we need to build across // SDK versions where one is unavailable or the other deprecated // We use the newer names in code and these macros to handle compatibility +#if (MAC_OS_X_VERSION_MAX_ALLOWED < 120000) // Before macOS 12 Monterey + #define kIOMainPortDefault kIOMasterPortDefault +#endif #if MAC_OS_X_VERSION_MAX_ALLOWED < 101200 #define NSBitmapFormatAlphaNonpremultiplied NSAlphaNonpremultipliedBitmapFormat #define NSEventMaskAny NSAnyEventMask