@@ -36,6 +36,8 @@ static void detectDisplays(FFDisplayServerResult* ds)
3636
3737 if (refreshRate == 0 )
3838 {
39+ #pragma clang diagnostic push
40+ #pragma clang diagnostic ignored "-Wdeprecated-declarations"
3941 CVDisplayLinkRef link ;
4042 if (CVDisplayLinkCreateWithCGDisplay (screen , & link ) == kCVReturnSuccess )
4143 {
@@ -44,6 +46,7 @@ static void detectDisplays(FFDisplayServerResult* ds)
4446 refreshRate = time .timeScale / (double ) time .timeValue ; //59.97...
4547 CVDisplayLinkRelease (link );
4648 }
49+ #pragma clang diagnostic pop
4750 }
4851
4952 ffStrbufClear (& buffer );
@@ -99,6 +102,10 @@ static void detectDisplays(FFDisplayServerResult* ds)
99102 );
100103 if (display )
101104 {
105+ #ifndef MAC_OS_X_VERSION_10_11
106+ FF_CFTYPE_AUTO_RELEASE CFStringRef pe = CGDisplayModeCopyPixelEncoding (mode );
107+ if (pe ) display -> bitDepth = (uint8_t ) (CFStringGetLength (pe ) - CFStringFind (pe , CFSTR ("B" ), 0 ).location );
108+ #else
102109 // https://stackoverflow.com/a/33519316/9976392
103110 // Also shitty, but better than parsing `CFCopyDescription(mode)`
104111 CFDictionaryRef dict = (CFDictionaryRef ) * ((int64_t * )mode + 2 );
@@ -108,6 +115,7 @@ static void detectDisplays(FFDisplayServerResult* ds)
108115 ffCfDictGetInt (dict , kCGDisplayBitsPerSample , & bitDepth );
109116 display -> bitDepth = (uint8_t ) bitDepth ;
110117 }
118+ #endif
111119
112120 if (display -> type == FF_DISPLAY_TYPE_BUILTIN )
113121 display -> hdrStatus = CFDictionaryContainsKey (displayInfo , CFSTR ("ReferencePeakHDRLuminance" ))
0 commit comments