]> git.sesse.net Git - vlc/commitdiff
macosx: don't listen to media keys if current playlist root is empty or media is...
authorFelix Paul Kühne <fkuehne@videolan.org>
Mon, 22 Apr 2013 20:48:07 +0000 (22:48 +0200)
committerFelix Paul Kühne <fkuehne@videolan.org>
Mon, 22 Apr 2013 20:52:06 +0000 (22:52 +0200)
modules/gui/macosx/MainWindow.m
modules/gui/macosx/intf.m

index ec141ce29c9b0dc6ef41eb6d705c34d3738565d4..e6f051a2af1e1e3b07793633bf2f91a845d359f9 100644 (file)
@@ -1052,6 +1052,10 @@ static VLCMainWindow *_o_sharedInstance = nil;
         [self showPodcastControls];
     else
         [self hidePodcastControls];
+
+    [[NSNotificationCenter defaultCenter] postNotificationName: @"VLCMediaKeySupportSettingChanged"
+                                                        object: nil
+                                                      userInfo: nil];
 }
 
 - (NSDragOperation)sourceList:(PXSourceList *)aSourceList validateDrop:(id <NSDraggingInfo>)info proposedItem:(id)item proposedChildIndex:(NSInteger)index
index f4a9fb15b81e09a860935d61a2b3e3cfd4f87049..a56fe9aa39ee245de21d3c2058986a2a77786d5c 100644 (file)
@@ -755,7 +755,6 @@ static VLCMain *_o_sharedMainInstance = nil;
     b_mediaKeySupport = var_InheritBool(VLCIntf, "macosx-mediakeys");
     if (b_mediaKeySupport) {
         o_mediaKeyController = [[SPMediaKeyTap alloc] initWithDelegate:self];
-        [o_mediaKeyController startWatchingMediaKeys];
         [[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:
                                                                  [SPMediaKeyTap defaultMediaKeyUserBundleIdentifiers], kMediaKeyUsingBundleIdentifiersDefaultsKey,
                                                                  nil]];
@@ -907,6 +906,8 @@ static VLCMain *_o_sharedMainInstance = nil;
     [o_usedHotkeys release];
     o_usedHotkeys = NULL;
 
+    [o_mediaKeyController release];
+
     [o_msg_lock release];
 
     /* write cached user defaults to disk */
@@ -1358,6 +1359,10 @@ static VLCMain *_o_sharedMainInstance = nil;
     [o_playlist playlistUpdated];
     [o_mainwindow updateWindow];
     [o_mainwindow updateName];
+
+    [[NSNotificationCenter defaultCenter] postNotificationName: @"VLCMediaKeySupportSettingChanged"
+                                                        object: nil
+                                                      userInfo: nil];
 }
 
 - (void)updateRecordState: (BOOL)b_value
@@ -1520,12 +1525,9 @@ static VLCMain *_o_sharedMainInstance = nil;
     [o_mainmenu setShuffle];
 }
 
-
 #pragma mark -
 #pragma mark Window updater
 
-
-
 - (void)setActiveVideoPlayback:(BOOL)b_value
 {
     b_active_videoplayback = b_value;
@@ -2030,7 +2032,12 @@ static VLCMain *_o_sharedMainInstance = nil;
     if (b_mediaKeySupport) {
         if (!o_mediaKeyController)
             o_mediaKeyController = [[SPMediaKeyTap alloc] initWithDelegate:self];
-        [o_mediaKeyController startWatchingMediaKeys];
+
+        if ([[[VLCMain sharedInstance] playlist] currentPlaylistRoot]->i_children > 0 ||
+            p_current_input)
+            [o_mediaKeyController startWatchingMediaKeys];
+        else
+            [o_mediaKeyController stopWatchingMediaKeys];
     }
     else if (!b_mediaKeySupport && o_mediaKeyController)
         [o_mediaKeyController stopWatchingMediaKeys];