CGDisplayRegisterReconfigurationCallback not called when view in fullscreen
Anyone familiar with CGDisplayRegisterReconfigurationCallback callback and fullscreen when connecting and disconnecting an external monitor? I have written an application that places a custom NSView into fullscreen (using enterfullscreenmode with options) on an external monitor while the main window remains on the main (built-in screen). The view enters and exits as expected but I was trying to cover all my bases and have the fullscreen exit gracefully if the external monitor is unplugged while my application is running. In my research I came across CGDisplayRegisterReconfigurationCallback. I implemented the callback as follows void TheDisplayReconfigurationCallBack ( CGDirectDisplayID display, CGDisplayChangeSummaryFlags flags, void *userInfo) { if (flags kCGDisplayAddFlag) { NSLog (@Display Added); } else if (kCGDisplayRemoveFlag) { NSLog (@Display Removed); [[NSNotificationCenter defaultCenter] postNotificationName:@ScreenDisconnected object:nil]; } } and called: CGDisplayRegisterReconfigurationCallback(TheDisplayReconfigurationCallBack, NULL); in a method in my implementation. When the application is not in fullscreen my application receives and the callback function works as expected. However, when the view is in fullscreen the callback function is not called when the monitor is unplugged. In fact the OS does not update the screen configuration until I exit fullscreen (through a test button I implemented on the main window). Any help would be appreciated I think I have exhausted all my google answers for CGDisplayRegisterReconfigurationCallback. Thanks Tom The applications runs on both 10.6 and 10.7. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: CGDisplayRegisterReconfigurationCallback not called when view in fullscreen
On Jul 24, 2012, at 7:47 PM, Tom Hohensee wrote: Anyone familiar with CGDisplayRegisterReconfigurationCallback callback and fullscreen when connecting and disconnecting an external monitor? I have written an application that places a custom NSView into fullscreen (using enterfullscreenmode with options) on an external monitor while the main window remains on the main (built-in screen). The view enters and exits as expected but I was trying to cover all my bases and have the fullscreen exit gracefully if the external monitor is unplugged while my application is running. In my research I came across CGDisplayRegisterReconfigurationCallback. When the application is not in fullscreen my application receives and the callback function works as expected. However, when the view is in fullscreen the callback function is not called when the monitor is unplugged. In fact the OS does not update the screen configuration until I exit fullscreen (through a test button I implemented on the main window). I suspect you're not receiving the callback because the display is captured. The docs for -[NSView enterFullScreenMode:withOptions:] explain how to avoid capturing the display. Capturing the display means that you're taking over sole responsibility and access to it. It also means that other apps won't be notified when that display's configuration is changed. (For example, the Finder won't rearrange your desktop icons if the display is set to a low-resolution mode.) It's not obvious to me that that would include preventing your own app from being informed when the display is disconnected, but apparently it does. You might file a bug with Apple. Also, you might ask on the quartz-dev list. Regards, Ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: CGDisplayRegisterReconfigurationCallback not called when view in fullscreen
Ken You are right. I was capturing the screen. Setting the presentation options in the options dictionary for enterFullScreenMode with options: did the trick. However, with the presentation options set, I am only getting one view to show the other is blacked out (ie the view on the external monitor is shown but the main screen on the built-in display is black). I have tried various presentation options but results are similar. Thanks Tom On Jul 24, 2012, at 8:09 PM, Ken Thomases wrote: On Jul 24, 2012, at 7:47 PM, Tom Hohensee wrote: Anyone familiar with CGDisplayRegisterReconfigurationCallback callback and fullscreen when connecting and disconnecting an external monitor? I have written an application that places a custom NSView into fullscreen (using enterfullscreenmode with options) on an external monitor while the main window remains on the main (built-in screen). The view enters and exits as expected but I was trying to cover all my bases and have the fullscreen exit gracefully if the external monitor is unplugged while my application is running. In my research I came across CGDisplayRegisterReconfigurationCallback. When the application is not in fullscreen my application receives and the callback function works as expected. However, when the view is in fullscreen the callback function is not called when the monitor is unplugged. In fact the OS does not update the screen configuration until I exit fullscreen (through a test button I implemented on the main window). I suspect you're not receiving the callback because the display is captured. The docs for -[NSView enterFullScreenMode:withOptions:] explain how to avoid capturing the display. Capturing the display means that you're taking over sole responsibility and access to it. It also means that other apps won't be notified when that display's configuration is changed. (For example, the Finder won't rearrange your desktop icons if the display is set to a low-resolution mode.) It's not obvious to me that that would include preventing your own app from being informed when the display is disconnected, but apparently it does. You might file a bug with Apple. Also, you might ask on the quartz-dev list. Regards, Ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com