Commit 99fbdecc authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: make sure that we don't block media keys for iTunes in case the user...

macosx: make sure that we don't block media keys for iTunes in case the user doesn't want to use them within VLC

Changing this option requires a relaunch now, which is automatically offered when needed.
parent df23caf7
...@@ -6,6 +6,7 @@ Mac OS X: ...@@ -6,6 +6,7 @@ Mac OS X:
* Update Auhal audio output to the latest API * Update Auhal audio output to the latest API
* Fix images disappearing issue on the interface * Fix images disappearing issue on the interface
* Reduced installation size by up to 30 MB * Reduced installation size by up to 30 MB
* Resolved conflict between iTunes and VLC wrt Media Key handling
Mozilla/ActiveX webplugin: Mozilla/ActiveX webplugin:
* Fullscreen mode is fixed on Win32 * Fullscreen mode is fixed on Win32
......
...@@ -574,14 +574,16 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -574,14 +574,16 @@ static VLCMain *_o_sharedMainInstance = nil;
if( !p_intf ) return; if( !p_intf ) return;
/* init media key support */ /* init media key support */
o_mediaKeyController = [[SPMediaKeyTap alloc] initWithDelegate:self];
b_mediaKeySupport = config_GetInt( VLCIntf, "macosx-mediakeys" ); b_mediaKeySupport = config_GetInt( VLCIntf, "macosx-mediakeys" );
if( b_mediaKeySupport )
{
o_mediaKeyController = [[SPMediaKeyTap alloc] initWithDelegate:self];
[o_mediaKeyController startWatchingMediaKeys]; [o_mediaKeyController startWatchingMediaKeys];
[o_mediaKeyController setShouldInterceptMediaKeyEvents:b_mediaKeySupport];
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(coreChangedMediaKeySupportSetting:) name: @"VLCMediaKeySupportSettingChanged" object: nil];
[[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys: [[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:
[SPMediaKeyTap defaultMediaKeyUserBundleIdentifiers], kMediaKeyUsingBundleIdentifiersDefaultsKey, [SPMediaKeyTap defaultMediaKeyUserBundleIdentifiers], kMediaKeyUsingBundleIdentifiersDefaultsKey,
nil]]; nil]];
}
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(coreChangedMediaKeySupportSetting:) name: @"VLCMediaKeySupportSettingChanged" object: nil];
[self _removeOldPreferences]; [self _removeOldPreferences];
...@@ -838,6 +840,9 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -838,6 +840,9 @@ static VLCMain *_o_sharedMainInstance = nil;
/* release some other objects here, because it isn't sure whether dealloc /* release some other objects here, because it isn't sure whether dealloc
* will be called later on */ * will be called later on */
if( o_mediaKeyController )
[o_mediaKeyController release];
if( nib_about_loaded ) if( nib_about_loaded )
[o_about release]; [o_about release];
...@@ -2843,7 +2848,30 @@ end: ...@@ -2843,7 +2848,30 @@ end:
- (void)coreChangedMediaKeySupportSetting: (NSNotification *)o_notification - (void)coreChangedMediaKeySupportSetting: (NSNotification *)o_notification
{ {
b_mediaKeySupport = config_GetInt( VLCIntf, "macosx-mediakeys" ); b_mediaKeySupport = config_GetInt( VLCIntf, "macosx-mediakeys" );
[o_mediaKeyController setShouldInterceptMediaKeyEvents: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);
}
}
} }
@end @end
......
...@@ -844,9 +844,6 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch ...@@ -844,9 +844,6 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch
[[[VLCMain sharedInstance] appleRemoteController] startListening: [VLCMain sharedInstance]]; [[[VLCMain sharedInstance] appleRemoteController] startListening: [VLCMain sharedInstance]];
else else
[[[VLCMain sharedInstance] appleRemoteController] stopListening: [VLCMain sharedInstance]]; [[[VLCMain sharedInstance] appleRemoteController] stopListening: [VLCMain sharedInstance]];
[[NSNotificationCenter defaultCenter] postNotificationName: @"VLCMediaKeySupportSettingChanged"
object: nil
userInfo: nil];
/* okay, let's save our changes to vlcrc */ /* okay, let's save our changes to vlcrc */
i = config_SaveConfigFile( p_intf, "main" ); i = config_SaveConfigFile( p_intf, "main" );
...@@ -1092,6 +1089,10 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch ...@@ -1092,6 +1089,10 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch
} }
b_hotkeyChanged = NO; b_hotkeyChanged = NO;
} }
[[NSNotificationCenter defaultCenter] postNotificationName: @"VLCMediaKeySupportSettingChanged"
object: nil
userInfo: nil];
} }
- (void)showSettingsForCategory: (id)o_new_category_view - (void)showSettingsForCategory: (id)o_new_category_view
......
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