summaryrefslogtreecommitdiffstats
path: root/osdep
diff options
context:
space:
mode:
authorStefano Pigozzi <stefano.pigozzi@gmail.com>2013-05-26 22:03:16 +0200
committerStefano Pigozzi <stefano.pigozzi@gmail.com>2013-05-26 23:46:50 +0200
commit41e6c922a58dd97a5c43855a58c3e879074ffc0f (patch)
tree7fe950ba5e41b7f1dde8e4a828adbfedf746375b /osdep
parent953b0eca3bdd1f59d52cd10c86bf1f1a8baf6f03 (diff)
downloadmpv-41e6c922a58dd97a5c43855a58c3e879074ffc0f.tar.bz2
mpv-41e6c922a58dd97a5c43855a58c3e879074ffc0f.tar.xz
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!
Diffstat (limited to 'osdep')
-rw-r--r--osdep/macosx_application.m7
1 files changed, 7 insertions, 0 deletions
diff --git a/osdep/macosx_application.m b/osdep/macosx_application.m
index 77c7779d49..e57b6545b0 100644
--- a/osdep/macosx_application.m
+++ b/osdep/macosx_application.m
@@ -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)