Commit 0aaae8bd authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: using the updated SPMediaKeyTap, we can disable the controller on the...

macosx: using the updated SPMediaKeyTap, we can disable the controller on the fly and no longer need to restart VLC to do so (close #6613)
parent c6aa5ac9
......@@ -2114,30 +2114,14 @@ unsigned int CocoaKeyToVLC( unichar i_key )
- (void)coreChangedMediaKeySupportSetting: (NSNotification *)o_notification
{
b_mediaKeySupport = config_GetInt( VLCIntf, "macosx-mediakeys" );
if (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);
}
}
[o_mediaKeyController stopWatchingMediaKeys];
}
@end
......@@ -2150,7 +2134,7 @@ unsigned int CocoaKeyToVLC( unichar i_key )
// when user selects the quit menu from dock it sends a terminate:
// but we need to send a stop: to properly exits libvlc.
// However, we are not able to change the action-method sent by this standard menu item.
// thus we override terminat: to send a stop:
// thus we override terminate: to send a stop:
// see [af97f24d528acab89969d6541d83f17ce1ecd580] that introduced the removal of setjmp() and longjmp()
- (void)terminate:(id)sender
{
......
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