5 #import <Cocoa/Cocoa.h>
6 #import <IOKit/graphics/IOGraphicsLib.h>
7 #include <AvailabilityMacros.h>
15 NSView *thisview =
static_cast<NSView *
>(View);
18 NSScreen *screen = [[thisview window] screen];
21 NSDictionary* desc = [screen deviceDescription];
22 return (CGDirectDisplayID)[[desc objectForKey:
@"NSScreenNumber"] intValue];
27 if (Number ==
nullptr)
30 if (!CFNumberGetValue(Number, kCFNumberSInt64Type, &Int64))
32 return Int64 == Uint32;
41 uint32_t vendor = CGDisplayVendorNumber(Display);
42 uint32_t model = CGDisplayModelNumber(Display);
43 uint32_t serial = CGDisplaySerialNumber(Display);
44 CFMutableDictionaryRef matching = IOServiceMatching(
"IODisplayConnect");
50 io_service_t service = 0;
51 while ((service = IOIteratorNext(iter)) != 0)
53 CFDictionaryRef
info = IODisplayCreateInfoDictionary(service, kIODisplayOnlyPreferredName);
54 CFNumberRef vendorID =
static_cast<CFNumberRef
>(CFDictionaryGetValue(
info, CFSTR(kDisplayVendorID)));
55 CFNumberRef productID =
static_cast<CFNumberRef
>(CFDictionaryGetValue(
info, CFSTR(kDisplayProductID)));
56 CFNumberRef serialNumber =
static_cast<CFNumberRef
>(CFDictionaryGetValue(
info, CFSTR(kDisplaySerialNumber)));
62 CFDataRef edid =
static_cast<CFDataRef
>(CFDictionaryGetValue(
info, CFSTR(kIODisplayEDIDKey)));
65 const char* data =
reinterpret_cast<const char*
>(CFDataGetBytePtr(edid));
66 int length = CFDataGetLength(edid);
67 result = QByteArray(data, length);
74 IOObjectRelease(iter);