|
8 | 8 | #include <CoreGraphics/CGDirectDisplay.h> |
9 | 9 | #include <CoreVideo/CVDisplayLink.h> |
10 | 10 |
|
| 11 | +#ifdef MAC_OS_X_VERSION_10_15 |
11 | 12 | extern CFDictionaryRef CoreDisplay_DisplayCreateInfoDictionary(CGDirectDisplayID display) __attribute__((weak_import)); |
12 | | -#ifndef MAC_OS_X_VERSION_10_15 |
13 | | -#import <IOKit/graphics/IOGraphicsLib.h> |
14 | | -extern CFDictionaryRef CoreDisplay_IODisplayCreateInfoDictionary(io_service_t framebuffer, IOOptionBits options) __attribute__((weak_import)); |
| 13 | +extern Boolean CoreDisplay_Display_IsHDRModeEnabled(CGDirectDisplayID display) __attribute__((weak_import)); |
| 14 | +#else |
| 15 | +#include <IOKit/graphics/IOGraphicsLib.h> |
15 | 16 | #endif |
16 | 17 |
|
17 | 18 | static void detectDisplays(FFDisplayServerResult* ds) |
@@ -43,30 +44,22 @@ static void detectDisplays(FFDisplayServerResult* ds) |
43 | 44 | } |
44 | 45 |
|
45 | 46 | FF_STRBUF_AUTO_DESTROY name = ffStrbufCreate(); |
| 47 | + CFDictionaryRef FF_CFTYPE_AUTO_RELEASE displayInfo = NULL; |
46 | 48 | #ifdef MAC_OS_X_VERSION_10_15 |
47 | 49 | if(CoreDisplay_DisplayCreateInfoDictionary) |
48 | | - { |
49 | | - CFDictionaryRef FF_CFTYPE_AUTO_RELEASE displayInfo = CoreDisplay_DisplayCreateInfoDictionary(screen); |
50 | | - if(displayInfo) |
51 | | - { |
52 | | - CFDictionaryRef productNames; |
53 | | - if(!ffCfDictGetDict(displayInfo, CFSTR(kDisplayProductName), &productNames)) |
54 | | - ffCfDictGetString(productNames, CFSTR("en_US"), &name); |
55 | | - } |
56 | | - } |
| 50 | + displayInfo = CoreDisplay_DisplayCreateInfoDictionary(screen); |
57 | 51 | #else |
58 | | - if(CoreDisplay_IODisplayCreateInfoDictionary) |
59 | 52 | { |
60 | 53 | io_service_t servicePort = CGDisplayIOServicePort(screen); |
61 | | - CFDictionaryRef FF_CFTYPE_AUTO_RELEASE displayInfo = CoreDisplay_IODisplayCreateInfoDictionary(servicePort, kIODisplayOnlyPreferredName); |
62 | | - if(displayInfo) |
63 | | - { |
64 | | - CFDictionaryRef productNames; |
65 | | - if(!ffCfDictGetDict(displayInfo, CFSTR(kDisplayProductName), &productNames)) |
66 | | - ffCfDictGetString(productNames, CFSTR("en_US"), &name); |
67 | | - } |
| 54 | + displayInfo = IODisplayCreateInfoDictionary(servicePort, kIODisplayOnlyPreferredName); |
68 | 55 | } |
69 | 56 | #endif |
| 57 | + if(displayInfo) |
| 58 | + { |
| 59 | + CFDictionaryRef productNames; |
| 60 | + if(!ffCfDictGetDict(displayInfo, CFSTR(kDisplayProductName), &productNames)) |
| 61 | + ffCfDictGetString(productNames, CFSTR("en_US"), &name); |
| 62 | + } |
70 | 63 |
|
71 | 64 | CGSize size = CGDisplayScreenSize(screen); |
72 | 65 |
|
@@ -95,6 +88,11 @@ static void detectDisplays(FFDisplayServerResult* ds) |
95 | 88 | ffCfDictGetInt(dict, kCGDisplayBitsPerSample, &bitDepth); |
96 | 89 | display->bitDepth = (uint8_t) bitDepth; |
97 | 90 | } |
| 91 | + |
| 92 | + if (CoreDisplay_Display_IsHDRModeEnabled) |
| 93 | + { |
| 94 | + display->hdrEnabled = CoreDisplay_Display_IsHDRModeEnabled(screen); |
| 95 | + } |
98 | 96 | } |
99 | 97 | CGDisplayModeRelease(mode); |
100 | 98 | } |
|
0 commit comments