From b22b970d1072706924dcc5315e98699d03dff2c3 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 29 Aug 2023 22:38:24 +0200 Subject: [PATCH] makepanda: Require macOS SDK 10.12 or higher This does not remove support for older macOS versions, they can still be targeted by newer SDKs (10.9 can still be targeted by the macOS 12 SDK) I would like to require macOS 11 SDK, but we still need 10.13 for FMOD --- makepanda/makepandacore.py | 2 +- panda/src/cocoadisplay/cocoaGraphicsWindow.mm | 14 +++++--------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/makepanda/makepandacore.py b/makepanda/makepandacore.py index bf3c626b6c..e7a93b48df 100644 --- a/makepanda/makepandacore.py +++ b/makepanda/makepandacore.py @@ -2441,7 +2441,7 @@ def SdkLocateMacOSX(archs = []): sdk_versions = [] if 'arm64' not in archs: # Prefer pre-10.14 for now so that we can keep building FMOD. - sdk_versions += ["10.13", "10.12", "10.11", "10.10", "10.9"] + sdk_versions += ["10.13", "10.12"] sdk_versions += ["14.0", "13.3", "13.1", "13.0", "12.3", "11.3", "11.1", "11.0"] diff --git a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm index 1b6cca2638..d212c84ebb 100644 --- a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm +++ b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm @@ -963,8 +963,8 @@ find_display_modes(int width, int height) { // handled. CGDisplayCopyAllDisplayModes() does not return upscaled display // mode unless explicitly asked with kCGDisplayShowDuplicateLowResolutionModes // (which is undocumented...). -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1080 - if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_14) { + bool macos_10_15_or_higher = false; + if (@available(macOS 10.15, *)) { const CFStringRef dictkeys[] = {kCGDisplayShowDuplicateLowResolutionModes}; const CFBooleanRef dictvalues[] = {kCFBooleanTrue}; options = CFDictionaryCreate(NULL, @@ -973,8 +973,8 @@ find_display_modes(int width, int height) { 1, &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); + macos_10_15_or_higher = true; } -#endif CFMutableArrayRef valid_modes; valid_modes = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks); @@ -994,7 +994,7 @@ find_display_modes(int width, int height) { // First check if the current mode is adequate. // This test not done for macOS 10.15 and above as the mode resolution is // not enough to identify a mode. - if (floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_14 && + if (!macos_10_15_or_higher && CGDisplayModeGetWidth(mode) == width && CGDisplayModeGetHeight(mode) == height) { CFArrayAppendValue(valid_modes, mode); @@ -1004,12 +1004,10 @@ find_display_modes(int width, int height) { current_pixel_encoding = CGDisplayModeCopyPixelEncoding(mode); refresh_rate = CGDisplayModeGetRefreshRate(mode); -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1080 // Calculate the pixel width and height of the fullscreen mode we want using // the currentdisplay mode dimensions and pixel dimensions. size_t expected_pixel_width = (size_t(width) * CGDisplayModeGetPixelWidth(mode)) / CGDisplayModeGetWidth(mode); size_t expected_pixel_height = (size_t(height) * CGDisplayModeGetPixelHeight(mode)) / CGDisplayModeGetHeight(mode); -#endif CGDisplayModeRelease(mode); for (size_t i = 0; i < num_modes; ++i) { @@ -1023,11 +1021,9 @@ find_display_modes(int width, int height) { if (CGDisplayModeGetWidth(mode) == width && CGDisplayModeGetHeight(mode) == height && (int)(CGDisplayModeGetRefreshRate(mode) + 0.5) == (int)(refresh_rate + 0.5) && -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1080 - (floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_14 || + (!macos_10_15_or_higher || (CGDisplayModeGetPixelWidth(mode) == expected_pixel_width && CGDisplayModeGetPixelHeight(mode) == expected_pixel_height)) && -#endif CFStringCompare(pixel_encoding, current_pixel_encoding, 0) == kCFCompareEqualTo) { if (CGDisplayModeGetRefreshRate(mode) == refresh_rate) {