• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSScreenNumber
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSScreenNumber


  • Subject: Re: NSScreenNumber
  • From: Shaun Wexler <email@hidden>
  • Date: Wed, 29 Oct 2003 13:04:17 -0800

On Oct 29, 2003, at 11:37 AM, Brian Christensen wrote:

Does anyone know since when the key @"NSScreenNumber" available through NSScreen's deviceDescription method has been providing the CGDirectDisplayID? According to the documentation: "An NSNumber that contains the CGDirectDisplayID for the screen device. This key is only valid for the device description dictionary for an NSScreen."

Maybe it's been around since 10.0, but I don't recall seeing this last year. Anybody know what system release introduced this key?

Nice to know yet another unsupported hack or two can now be eliminated.

@interface NSScreen (CGDirectDisplayID)
- (CGDirectDisplayID)displayID;
- (double)refreshRate;
- (void)waitForVBL;
- (BOOL)usesQuartzExtreme;
@end

@implementation NSScreen (CGDirectDisplayID)

- (CGDirectDisplayID)displayID
{
return _screenNumber;
}

- (double)refreshRate
{
double refresh_rate = 0.0;
CFDictionaryRef modeDictionary = CGDisplayCurrentMode((CGDirectDisplayID)_screenNumber);
if (modeDictionary) {
CFNumberRef rateRef = (CFNumberRef)CFDictionaryGetValue(modeDictionary, kCGDisplayRefreshRate);
if (rateRef) {
CFNumberGetValue(rateRef, kCFNumberDoubleType, &refresh_rate);
}
}
return refresh_rate > 0.0 ? refresh_rate : 60.0;
}

- (void)waitForVBL
{
CGDisplayErr err;
err = CGDisplayWaitForBeamPositionOutsideLines((CGDirectDisplayID)_screenNumbe r, (CGBeamPosition)0, (CGBeamPosition)(_frame.size.height - 1));
}

- (BOOL)usesQuartzExtreme
{
return CGDisplayUsesOpenGLAcceleration((CGDirectDisplayID)_screenNumber);
}

@end
--
Shaun Wexler
MacFOH
http://www.macfoh.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >NSScreenNumber (From: Brian Christensen <email@hidden>)

  • Prev by Date: Re: DVD playback format?
  • Next by Date: Archive
  • Previous by thread: NSScreenNumber
  • Next by thread: Plugins for Mail
  • Index(es):
    • Date
    • Thread