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

macosx: implemented on-the-fly activation of the Media Key support

parent b84692b8
......@@ -433,7 +433,7 @@ struct intf_sys_t
BOOL b_mediaKeySupport;
}
- (void)enableMediaKeySupport:(BOOL)b_value;
- (void)coreChangedMediaKeySupportSetting: (NSNotification *)o_notification;
- (void)sendEvent: (NSEvent*)event;
- (void)resetJump;
......
......@@ -2863,11 +2863,18 @@ end:
- (void)awakeFromNib
{
b_mediaKeySupport = config_GetInt( VLCIntf, "macosx-mediakeys" );
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(coreChangedMediaKeySupportSetting:) name: @"VLCMediaKeySupportSettingChanged" object: nil];
}
- (void)enableMediaKeySupport:(BOOL)b_value
- (void)dealloc
{
b_mediaKeySupport = b_value;
[[NSNotificationCenter defaultCenter] removeObserver: self];
[super dealloc];
}
- (void)coreChangedMediaKeySupportSetting: (NSNotification *)o_notification
{
b_mediaKeySupport = config_GetInt( VLCIntf, "macosx-mediakeys" );
}
- (void)sendEvent: (NSEvent*)event
......
......@@ -748,6 +748,9 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch
[[[VLCMain sharedInstance] appleRemoteController] startListening: [VLCMain sharedInstance]];
else
[[[VLCMain sharedInstance] appleRemoteController] stopListening: [VLCMain sharedInstance]];
[[NSNotificationCenter defaultCenter] postNotificationName: @"VLCMediaKeySupportSettingChanged"
object: nil
userInfo: nil];
/* okay, let's save our changes to vlcrc */
i = config_SaveConfigFile( p_intf, "main" );
......
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