Display sleep vs. enterFullScreenMode
-
Hello,
I have an application that uses NSView's
enterFullScreenMode/exitFullScreenModeWithOptions in order to toggle
between fullscreen and normal display mode. Evidently, the default
behavior while in full screen mode is to disable OSX's display sleep
timer. How can I re-enable it? I do not want my application to
interfere with the user's default sleep settings (unless my
application explicitly needs to when it's in a given mode--but that
doesn't depend on whether it's in fullscreen or normal mode).
Thank you for any help.
Shayne Wissler -
Shayne Wissler (<wissler...>) on 2008-12-31 3:11 PM said:
> I have an application that uses NSView's
> enterFullScreenMode/exitFullScreenModeWithOptions in order to toggle
> between fullscreen and normal display mode. Evidently, the default
> behavior while in full screen mode is to disable OSX's display sleep
> timer. How can I re-enable it? I do not want my application to
> interfere with the user's default sleep settings (unless my
> application explicitly needs to when it's in a given mode--but that
> doesn't depend on whether it's in fullscreen or normal mode).
I can confirm your results. enterFullScreenMode is not documented to
have that effect. It ends up calling CGDisplayCapture(), perhaps it is
responsible for that.
Sigh. Another reason to avoid enterFullScreenMode I'm afraid. Here's
my list of why:
- prevents display sleep
- does not allow menubar to autoshow/hide
- does not allow dock to autoshow/hide
- does not allow cmd-tabbing between apps
- does not allow exposé to be invoked
- invoking force quit kills the app instead of showing force quit dialog
- documentation says you can choose the window level
(NSFullScreenModeWindowLevel), but implementation does not honour it,
instead always uses kCGMaximumWindowLevel-1.
- using SetSystemUIMode() does not work with enterFullScreenMode
- other apps are not notified when your app goes fullscreen
(kEventAppSystemUIModeChanged Carbon event)
- going fullscreen invokes "-(void)viewWillMoveToSuperview:
(NSView*)newSuperview" with a nil newSuperview. This is the condition
that one generally uses to call unbind: on one's view.
<http://homepage.mac.com/mmalc/CocoaExamples/controllers.html#unbinding>
Hopefully in 10.6 this API will become usable.
Sean -
Is there any way to re-enable the display sleep timer? Or do I need to
implement my own display sleep timer if I use that API?
Thanks for your help.
Shayne Wissler
On Wed, Dec 31, 2008 at 4:34 PM, Sean McBride <cwatson...> wrote:
> Shayne Wissler (<wissler...>) on 2008-12-31 3:11 PM said:
>
>> I have an application that uses NSView's
>> enterFullScreenMode/exitFullScreenModeWithOptions in order to toggle
>> between fullscreen and normal display mode. Evidently, the default
>> behavior while in full screen mode is to disable OSX's display sleep
>> timer. How can I re-enable it? I do not want my application to
>> interfere with the user's default sleep settings (unless my
>> application explicitly needs to when it's in a given mode--but that
>> doesn't depend on whether it's in fullscreen or normal mode).
>
> I can confirm your results. enterFullScreenMode is not documented to
> have that effect. It ends up calling CGDisplayCapture(), perhaps it is
> responsible for that.
>
> Sigh. Another reason to avoid enterFullScreenMode I'm afraid. Here's
> my list of why:
>
> - prevents display sleep
> - does not allow menubar to autoshow/hide
> - does not allow dock to autoshow/hide
> - does not allow cmd-tabbing between apps
> - does not allow exposé to be invoked
> - invoking force quit kills the app instead of showing force quit dialog
> - documentation says you can choose the window level
> (NSFullScreenModeWindowLevel), but implementation does not honour it,
> instead always uses kCGMaximumWindowLevel-1.
> - using SetSystemUIMode() does not work with enterFullScreenMode
> - other apps are not notified when your app goes fullscreen
> (kEventAppSystemUIModeChanged Carbon event)
> - going fullscreen invokes "-(void)viewWillMoveToSuperview:
> (NSView*)newSuperview" with a nil newSuperview. This is the condition
> that one generally uses to call unbind: on one's view.
> <http://homepage.mac.com/mmalc/CocoaExamples/controllers.html#unbinding>
>
> Hopefully in 10.6 this API will become usable.
>
> Sean
>
>
>
-
Shayne Wissler (<wissler...>) on 2009-01-01 4:43 PM said:
> Is there any way to re-enable the display sleep timer? Or do I need to
> implement my own display sleep timer if I use that API?
There probably isn't a Cocoa way. But you probably can with IOKit. I'd
start by googling "kIOPMAssertionTypeNoDisplaySleep". The darwin list,
and archives, can help with IOKit.
Sean



