Aonir
Aonir

Reputation: 23

Mac OS X Fullsreen switch on Cmd-Tab

My game (Mac OS X 10.5 compatible) needs a feature to switch(minimize) from fullscreen mode on Cmd-Tab command and leave focus at this time, so user can use other applications while my game is minimized(browser for example). How to do this?

Thank you!

Upvotes: 1

Views: 1005

Answers (2)

Aonir
Aonir

Reputation: 23

Thanks Matthias! I've find the solution, the problem was that my fullscreen window was a top window [fullscreenWindow setLevel: NSScreenSaverWindowLevel-1]; so it captured all events every time. I've used this methods to catch the moment when my application loses/gets focus, and the I hide/unhide my app with all the windows:

- (void)applicationWillBecomeActive:(NSNotification *)aNotification
{
       [mApp unhide:self];
}
- (void)applicationWillResignActive:(NSNotification *)aNotification
{

     [mApp hide:self];

}
- (void)applicationWillFinishLaunching:(NSNotification *)aNotification
{
    mApp=[aNotification object];
}

Upvotes: 0

Matthias
Matthias

Reputation: 8180

I am not sure, what your question is. If you want to know, how you catch tne even, then you can use

   NSWindowWillExitFullScreenNotification

or

  NSWindowDidExitFullScreenNotification

More information to this very windows protocol you may find here: https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/NSWindowDelegate_Protocol/Reference/Reference.html#//apple_ref/doc/uid/TP40008202

Upvotes: 1

Related Questions