[vlc-commits] macosx: don' t listen to media keys if current playlist root is empty or media is being played (close #5612)

Felix Paul Kühne git at videolan.org
Mon Apr 22 22:52:07 CEST 2013


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Mon Apr 22 22:48:07 2013 +0200| [28618398b0cb4cf5a8f8049618b8ed031e2e89a4] | committer: Felix Paul Kühne

macosx: don't listen to media keys if current playlist root is empty or media is being played (close #5612)

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

 modules/gui/macosx/MainWindow.m |    4 ++++
 modules/gui/macosx/intf.m       |   17 ++++++++++++-----
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/modules/gui/macosx/MainWindow.m b/modules/gui/macosx/MainWindow.m
index ec141ce..e6f051a 100644
--- a/modules/gui/macosx/MainWindow.m
+++ b/modules/gui/macosx/MainWindow.m
@@ -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
diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m
index f4a9fb1..a56fe9a 100644
--- a/modules/gui/macosx/intf.m
+++ b/modules/gui/macosx/intf.m
@@ -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];



More information about the vlc-commits mailing list