Commit 28618398 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: don't listen to media keys if current playlist root is empty or media...

macosx: don't listen to media keys if current playlist root is empty or media is being played (close #5612)
parent 777ce9ac
......@@ -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
......
......@@ -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];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment