Skip to content
Snippets Groups Projects
Commit 63e84a06 authored by Felix Paul Kühne's avatar Felix Paul Kühne
Browse files

macosx: fix intf variable callbacks

parent 076badfb
No related branches found
No related tags found
No related merge requests found
......@@ -66,15 +66,14 @@
selector:@selector(coreChangedAppleRemoteSetting:)
name:VLCAppleRemoteSettingChangedNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(startListeningWithAppleRemote)
name:NSApplicationDidBecomeActiveNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(stopListeningWithAppleRemote)
name:NSApplicationDidResignActiveNotification
object:nil];
[notificationCenter addObserver:self
selector:@selector(startListeningWithAppleRemote)
name:NSApplicationDidBecomeActiveNotification
object:nil];
[notificationCenter addObserver:self
selector:@selector(stopListeningWithAppleRemote)
name:NSApplicationDidResignActiveNotification
object:nil];
/* init Apple Remote support */
_remote = [[AppleRemote alloc] init];
......
......@@ -81,20 +81,19 @@ static int BossCallback(vlc_object_t *p_this, const char *psz_var,
{
self = [super init];
if (self) {
intf_thread_t *p_intf = getIntf();
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
[notificationCenter addObserver:self
selector:@selector(applicationWillTerminate:)
name:NSApplicationWillTerminateNotification
object:nil];
selector:@selector(applicationWillTerminate:)
name:NSApplicationWillTerminateNotification
object:nil];
_clickerManager = [[VLCClickerManager alloc] init];
_playlistController = [[VLCMain sharedInstance] playlistController];
_playerController = [_playlistController playerController];
// FIXME: this variable will live on the current libvlc instance now. Depends on a future patch
var_AddCallback(p_intf, "intf-boss", BossCallback, (__bridge void *)self);
intf_thread_t *p_intf = getIntf();
libvlc_int_t* libvlc = vlc_object_instance(p_intf);
var_AddCallback(libvlc, "intf-boss", BossCallback, (__bridge void *)self);
}
return self;
}
......@@ -102,8 +101,9 @@ static int BossCallback(vlc_object_t *p_this, const char *psz_var,
- (void)applicationWillTerminate:(NSNotification *)notification
{
// Dealloc is never called because this is a singleton, so we should cleanup manually before termination
// FIXME: this variable will live on the current libvlc instance now. Depends on a future patch
var_DelCallback(getIntf(), "intf-boss", BossCallback, (__bridge void *)self);
intf_thread_t *p_intf = getIntf();
libvlc_int_t* libvlc = vlc_object_instance(p_intf);
var_DelCallback(libvlc, "intf-boss", BossCallback, (__bridge void *)self);
[[NSNotificationCenter defaultCenter] removeObserver: self];
_clickerManager = nil;
_usedHotkeys = nil;
......
......@@ -243,9 +243,9 @@ static VLCMain *sharedInstance = nil;
_mainWindowController = [[NSWindowController alloc] initWithWindowNibName:@"MainWindow"];
_libraryWindowController = [[VLCLibraryWindowController alloc] initWithLibraryWindow];
// FIXME: those variables will live on the current libvlc instance now. Depends on a future patch
var_AddCallback(p_intf, "intf-toggle-fscontrol", ShowController, (__bridge void *)self);
var_AddCallback(p_intf, "intf-show", ShowController, (__bridge void *)self);
libvlc_int_t *libvlc = vlc_object_instance(p_intf);
var_AddCallback(libvlc, "intf-toggle-fscontrol", ShowController, (__bridge void *)self);
var_AddCallback(libvlc, "intf-show", ShowController, (__bridge void *)self);
// Load them here already to apply stored profiles
_videoEffectsPanel = [[VLCVideoEffectsWindowController alloc] init];
......@@ -337,8 +337,9 @@ static VLCMain *sharedInstance = nil;
[[self videoEffectsPanel] saveCurrentProfileAtTerminate];
[[self audioEffectsPanel] saveCurrentProfileAtTerminate];
var_DelCallback(p_intf, "intf-toggle-fscontrol", ShowController, (__bridge void *)self);
var_DelCallback(p_intf, "intf-show", ShowController, (__bridge void *)self);
libvlc_int_t *libvlc = vlc_object_instance(p_intf);
var_DelCallback(libvlc, "intf-toggle-fscontrol", ShowController, (__bridge void *)self);
var_DelCallback(libvlc, "intf-show", ShowController, (__bridge void *)self);
[[NSNotificationCenter defaultCenter] removeObserver: self];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment