Skip to content

Instantly share code, notes, and snippets.

@garethjenkins
garethjenkins / gist:3029471
Created July 1, 2012 20:20
output of CGDisplayModeGetWidth & ...Height
2012-07-01 21:20:11.693 Retina Resolution Menu[72088:403] w, h: 2880, 1800
2012-07-01 21:20:11.693 Retina Resolution Menu[72088:403] w, h: 2880, 1800
2012-07-01 21:20:11.694 Retina Resolution Menu[72088:403] w, h: 1440, 900
2012-07-01 21:20:11.694 Retina Resolution Menu[72088:403] w, h: 1440, 900
2012-07-01 21:20:11.694 Retina Resolution Menu[72088:403] w, h: 2560, 1600
2012-07-01 21:20:11.695 Retina Resolution Menu[72088:403] w, h: 2560, 1600
2012-07-01 21:20:11.695 Retina Resolution Menu[72088:403] w, h: 2048, 1280
2012-07-01 21:20:11.695 Retina Resolution Menu[72088:403] w, h: 2048, 1280
2012-07-01 21:20:11.696 Retina Resolution Menu[72088:403] w, h: 1024, 768
2012-07-01 21:20:11.696 Retina Resolution Menu[72088:403] w, h: 1024, 768
@garethjenkins
garethjenkins / gist:3029465
Created July 1, 2012 20:17
log output of NSScreen
2012-07-01 21:16:37.979 Retina Resolution Menu[72064:403]
2012-07-01 21:16:37.979 Retina Resolution Menu[72064:403] description: <NSScreen: 0x7f870a903730>
2012-07-01 21:16:37.981 Retina Resolution Menu[72064:403] backing scale factor: 2.000000
2012-07-01 21:16:37.981 Retina Resolution Menu[72064:403] frame {{-1920, 240}, {1920, 1200}}
2012-07-01 21:16:37.981 Retina Resolution Menu[72064:403] visibleFrame {{-1916, 240}, {1916, 1200}}
2012-07-01 21:16:37.982 Retina Resolution Menu[72064:403] device description: {
NSDeviceBitsPerSample = 8;
NSDeviceColorSpaceName = NSCalibratedRGBColorSpace;
NSDeviceIsScreen = YES;
NSDeviceResolution = "NSSize: {144, 144}";
@garethjenkins
garethjenkins / gist:3029459
Created July 1, 2012 20:14
context of plist
<plist version="1.0">
<dict>
<key>IOGFlags</key>
<integer>4</integer>
<key>scale-resolutions</key>
<array>
<!-- internal panel modes AND modes mirroring external panels (but not kDisplayModeValidForMirroringFlag) " -->
<!-- This list includes sizes that overlap between and preferred sizes the internal panel and common matches for external displays" -->
<!-- If the internal panel does not need a sizes then set kDisplayModeValidForMirroringFlag and move them down to that list " -->
@garethjenkins
garethjenkins / gist:3029444
Created July 1, 2012 20:11
output of grep ' 2x'
DisplayProductID-a00e: <data>AAAPAAAACWAAAAAJAKAAAA==</data> <!-- 3840x2400 mirror external panels to internal (include 2x) -->
DisplayProductID-a00e: <data>AAANIAAACDQAAAAJAKAAAA==</data> <!-- 3360x2100 mirror external panels to internal (include 2x) -->
DisplayProductID-a00e: <data>AAALQAAABwgAAAAJAKAAAA==</data> <!-- 2880x1800 mirror external panels to internal (include 2x) -->
DisplayProductID-a00e: <data>AAAKAAAABkAAAAAJAKAAAA==</data> <!-- 2650x1600 mirror external panels to internal (include 2x) -->
DisplayProductID-a00e: <data>AAAHgAAABLAAAAAJAKAAAA==</data> <!-- 1920x1200 mirror external panels to internal (include 2x) -->
DisplayProductID-a00e: <data>AAAHgAAABDgAAAAJACAAAA==</data> <!-- 1920x1080 mirror external panels to internal 1080p (no 2x) -->
DisplayProductID-a00e: <data>AAAFAAAAAtAAAAAJACAAAA==</data> <!-- 1280x720 mirror external panels to internal 720p (no 2x) -->
@garethjenkins
garethjenkins / gist:3027840
Created July 1, 2012 10:26
enumerate displays using CGGetActiveDisplayList
CGDirectDisplayID displays[MAX_DISPLAYS];
uint32_t numDisplays;
uint32_t i;
CGGetActiveDisplayList(MAX_DISPLAYS, displays, &numDisplays);
for(i=0; i<numDisplays; i++)
{
CGDisplayModeRef mode;
CFIndex index, count;
@garethjenkins
garethjenkins / gist:3027835
Created July 1, 2012 10:22
Write NSScreen output to log
NSArray *screens=[NSScreen screens];
for(NSScreen *s in screens)
{
NSLog(@"\n");
NSLog(@"description: %@", s.description);
NSLog(@"backing scale factor: %f", s.backingScaleFactor);
NSLog(@"frame %@", NSStringFromRect(s.frame));
NSLog(@"visibleFrame %@", NSStringFromRect(s.visibleFrame));
NSLog(@"device description: %@", s.deviceDescription);
NSLog(@"------------------------------------\n\n");