1

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!

Aonir
  • 23
  • 5

2 Answers2

1

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

Matthias
  • 8,018
  • 2
  • 27
  • 53
  • It can be useful, but the main problem is my app can not release focus when in fullscreen, so user cannot switch to any other application – Aonir Feb 27 '12 at 11:42
  • I just see, that you talk of MacOSX 10.5. Full screen mode was introduced in 10.7. – Matthias Feb 27 '12 at 11:54
  • No,fullscreen mode itself works fine, it's just OpenGL fullscreen in a borderlesswindow with size the same as screen. – Aonir Feb 27 '12 at 12:01
  • @Aonir Well, that is IMHO not what is called full screen mode. But then, I see not the difference to a normal window. Are you doing some special input? Usually, if you do not set something like **NSApplicationPresentationDisableProcessSwitching** in **NSApplicationPresentationOptions**, switching is done for you and your application will be notified. – Matthias Feb 27 '12 at 12:22
0

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];
}
Aonir
  • 23
  • 5