Re: DisplayReconfigurationCallBack with nil cgDisplayID
Re: DisplayReconfigurationCallBack with nil cgDisplayID
- Subject: Re: DisplayReconfigurationCallBack with nil cgDisplayID
- From: Michael Babin <email@hidden>
- Date: Thu, 23 Aug 2012 13:01:04 -0500
On Aug 23, 2012, at 8:55 AM, Trygve Inda <email@hidden> wrote:
> Very occasionally when my MyDisplayReconfigurationCallBack is called:
>
> void DisplayReconfigurationCallBack (CGDirectDisplayID cgDisplayID,
> CGDisplayChangeSummaryFlags flags, void *userInfo)
>
> The system sends me a nil value for cgDisplayID
>
> When I try to cycle through the array of NSScreen to find the one that
> matches cgDisplayID it never finds it since 0 is not a valid cgDisplayID.
>
> What is causing this?
>
> I mostly see it on Thunderbolt Macs
Interesting. My similar callback function doesn't really pay attention to the display ID parameter passed in, so a nil value wouldn't be a problem.
Any notable pattern to the flags value in these cases?
There is a kCGNullDirectDisplay constant (CGDirectDisplay.h), although it is rarely referenced in the header file comments or documentation (seems to be used as an invalid/not applicable return value, or a cancel/disable flag on input, where referenced). A couple of the old Carbon HIWindow API's used it to denote the main display on input. Not sure why it is returned or what it means in the context of the reconfiguration callback.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden