[vlc-commits] macosx: using the updated SPMediaKeyTap, we can disable the controller on the fly and no longer need to restart VLC to do so (close #6613)

Felix Paul Kühne git at videolan.org
Fri May 18 16:06:36 CEST 2012


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Fri May 18 16:05:55 2012 +0200| [0aaae8bd58be075548276b3696b9badb998da28f] | committer: Felix Paul Kühne

macosx: using the updated SPMediaKeyTap, we can disable the controller on the fly and no longer need to restart VLC to do so (close #6613)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0aaae8bd58be075548276b3696b9badb998da28f
---

 modules/gui/macosx/intf.m |   24 ++++--------------------
 1 file changed, 4 insertions(+), 20 deletions(-)

diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m
index d297863..7fed53b 100644
--- a/modules/gui/macosx/intf.m
+++ b/modules/gui/macosx/intf.m
@@ -2114,30 +2114,14 @@ unsigned int CocoaKeyToVLC( unichar i_key )
 - (void)coreChangedMediaKeySupportSetting: (NSNotification *)o_notification
 {
     b_mediaKeySupport = config_GetInt( VLCIntf, "macosx-mediakeys" );
-    if (b_mediaKeySupport) {
+    if (b_mediaKeySupport)
+    {
         if (!o_mediaKeyController)
             o_mediaKeyController = [[SPMediaKeyTap alloc] initWithDelegate:self];
         [o_mediaKeyController startWatchingMediaKeys];
     }
     else if (!b_mediaKeySupport && o_mediaKeyController)
-    {
-        int returnedValue = NSRunInformationalAlertPanel(_NS("Relaunch required"),
-                                               _NS("To make sure that VLC no longer listens to your media key events, it needs to be restarted."),
-                                               _NS("Relaunch VLC"), _NS("Ignore"), nil, nil);
-        if( returnedValue == NSOKButton )
-        {
-            /* Relaunch now */
-            const char * path = [[[NSBundle mainBundle] executablePath] UTF8String];
-
-            /* For some reason we need to fork(), not just execl(), which reports a ENOTSUP then. */
-            if(fork() != 0)
-            {
-                exit(0);
-                return;
-            }
-            execl(path, path, NULL);
-        }
-    }
+        [o_mediaKeyController stopWatchingMediaKeys];
 }
 
 @end
@@ -2150,7 +2134,7 @@ unsigned int CocoaKeyToVLC( unichar i_key )
 // when user selects the quit menu from dock it sends a terminate:
 // but we need to send a stop: to properly exits libvlc.
 // However, we are not able to change the action-method sent by this standard menu item.
-// thus we override terminat: to send a stop:
+// thus we override terminate: to send a stop:
 // see [af97f24d528acab89969d6541d83f17ce1ecd580] that introduced the removal of setjmp() and longjmp()
 - (void)terminate:(id)sender
 {



More information about the vlc-commits mailing list