Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Looks like option (D) is the best, with some changes. Apparently OS X has a pretty good idea about the real-world size of the display and you can <a href="https://stackoverflow.com/questions/12589198/how-to-read-the-physical-screen-size-of-osx">get it via CGDisplayScreenSize</a>. It's then pretty straightforward to pick the largest one and assume that's the presentation screen. </p> <p>Granted this doesn't accurately measure projectors, but my informal testing shows that the function returns pretty good pixel per inch values for each screen:</p> <ul> <li>Macbook Air 13": {290, 180} mm, 126 ppi</li> <li>Apple Cinema Display: {596, 336} mm, 109 ppi</li> <li>An Epson Overhead Projector: {799, 450} mm, 61 ppi</li> </ul> <p>(the above were converted with a constant 25.4 millimeters per inch).</p> <p>Here's the code that I used:</p> <pre><code>#import &lt;Foundation/Foundation.h&gt; #import &lt;AppKit/AppKit.h&gt; #import &lt;ApplicationServices/ApplicationServices.h&gt; int main(int argc, char *argv[]) { @autoreleasepool { NSArray* screens = [NSScreen screens]; CGFloat __block biggestArea = 0; NSScreen* __block presentationScreen; NSUInteger __block presentationScreenIndex; [screens enumerateObjectsUsingBlock:^(NSScreen* screen,NSUInteger idx,BOOL* stop){ NSDictionary *description = [screen deviceDescription]; NSSize displayPixelSize = [[description objectForKey:NSDeviceSize] sizeValue]; CGSize displayPhysicalSize = CGDisplayScreenSize( [[description objectForKey:@"NSScreenNumber"] unsignedIntValue]); NSLog(@"Screen %d Physical Size: %@ ppi is %0.2f",(int) idx, NSStringFromSize(displayPhysicalSize), (displayPixelSize.width / displayPhysicalSize.width) * 25.4f); // there being 25.4 mm in an inch CGFloat screenArea = displayPhysicalSize.width * displayPhysicalSize.height; if(screenArea &gt; biggestArea) { presentationScreen = screen; biggestArea = screenArea; presentationScreenIndex = idx; } }]; NSLog(@"Presentation screen: index: %d %@",(int) presentationScreenIndex,presentationScreen); } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload