macosx_application: fix menu 'ghosting'

This fixes a bug that caused the application to never leave it's frontmost
position.

The idea is stolen from @donmelton who used it in MPlayerShell. Thanks!
This commit is contained in:
Stefano Pigozzi 2013-05-26 22:03:16 +02:00
parent 953b0eca3b
commit 41e6c922a5
1 changed files with 7 additions and 0 deletions

View File

@ -276,6 +276,13 @@ void init_cocoa_application(void)
[NSApp setDelegate:app];
[app initialize_menu];
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
atexit_b(^{
// Because activation policy has just been set to behave like a real
// application, that policy must be reset on exit to prevent, among
// other things, the menubar created here from remaining on screen.
[NSApp setActivationPolicy:NSApplicationActivationPolicyProhibited];
});
}
void terminate_cocoa_application(void)