|
4 | 4 | #include "util/apple/ddcci.h" |
5 | 5 | #include "util/edidHelper.h" |
6 | 6 |
|
| 7 | +#import <AppKit/NSScreen.h> |
| 8 | +#import <Foundation/Foundation.h> |
| 9 | + |
7 | 10 | extern CFDictionaryRef CoreDisplay_DisplayCreateInfoDictionary(CGDirectDisplayID display) __attribute__((weak_import)); |
8 | 11 |
|
9 | 12 | static const char* detectWithDisplayServices(const FFDisplayServerResult* displayServer, FFlist* results) |
@@ -31,6 +34,30 @@ static const char* detectWithDisplayServices(const FFDisplayServerResult* displa |
31 | 34 | CGSize size = CGDisplayScreenSize((CGDirectDisplayID) display->id); |
32 | 35 | monitor->physicalWidth = (uint32_t) (size.width + 0.5); |
33 | 36 | monitor->physicalHeight = (uint32_t) (size.height + 0.5); |
| 37 | + monitor->hdrCompatible = false; |
| 38 | + |
| 39 | + if (CFDictionaryContainsKey(displayInfo, CFSTR("ReferencePeakHDRLuminance"))) |
| 40 | + monitor->hdrCompatible = true; |
| 41 | + else |
| 42 | + { |
| 43 | + NSScreen* mainScreen = NSScreen.mainScreen; |
| 44 | + if (display->primary) |
| 45 | + monitor->hdrCompatible = mainScreen.maximumPotentialExtendedDynamicRangeColorComponentValue > 1; |
| 46 | + else |
| 47 | + { |
| 48 | + for (NSScreen* screen in NSScreen.screens) |
| 49 | + { |
| 50 | + if (screen == mainScreen) continue; |
| 51 | + NSNumber* screenNumber = [screen.deviceDescription valueForKey:@"NSScreenNumber"]; |
| 52 | + if (screenNumber && screenNumber.longValue == 1) |
| 53 | + { |
| 54 | + monitor->hdrCompatible = screen.maximumPotentialExtendedDynamicRangeColorComponentValue > 1; |
| 55 | + break; |
| 56 | + } |
| 57 | + } |
| 58 | + continue; |
| 59 | + } |
| 60 | + } |
34 | 61 | } |
35 | 62 | } |
36 | 63 | } |
@@ -93,6 +120,7 @@ static const char* detectWithDdcci(FFlist* results) |
93 | 120 | ffStrbufInit(&display->name); |
94 | 121 | ffEdidGetName(edidData, &display->name); |
95 | 122 | ffEdidGetPhysicalSize(edidData, &display->physicalWidth, &display->physicalHeight); |
| 123 | + monitor->hdrCompatible = false; |
96 | 124 | } |
97 | 125 | return NULL; |
98 | 126 | } |
|
0 commit comments