Commit 3d7351e6 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: make sure that NSApplicationWillTerminateNotification reaches all of its observers

parent 1fb57312
......@@ -112,8 +112,6 @@ static VLCMainWindow *_o_sharedInstance = nil;
[o_color_backdrop release];
[[NSNotificationCenter defaultCenter] removeObserver: self];
config_PutInt( VLCIntf->p_libvlc, "volume", i_lastShownVolume );
[self saveFrameUsingName: [self frameAutosaveName]];
[o_sidebaritems release];
[super dealloc];
}
......@@ -427,12 +425,13 @@ static VLCMainWindow *_o_sharedInstance = nil;
winrect.size.height = winrect.size.height - f_titleBarHeight;
[o_split_view setFrame: winrect];
[o_video_view setFrame: winrect];
previousSavedFrame = winrect;
o_color_backdrop = [[VLCColorView alloc] initWithFrame: [o_split_view frame]];
[[self contentView] addSubview: o_color_backdrop positioned: NSWindowBelow relativeTo: o_split_view];
[o_color_backdrop setAutoresizingMask:NSViewHeightSizable | NSViewWidthSizable];
previousSavedFrame = winrect;
[self display];
}
else
......@@ -459,6 +458,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(someWindowWillClose:) name: NSWindowWillCloseNotification object: nil];
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(someWindowWillMiniaturize:) name: NSWindowWillMiniaturizeNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(applicationWillTerminate:) name: NSApplicationWillTerminateNotification object: nil];
}
#pragma mark -
......@@ -894,6 +894,27 @@ static VLCMainWindow *_o_sharedInstance = nil;
[self saveFrameUsingName: [self frameAutosaveName]];
}
- (void)applicationWillTerminate:(NSNotification *)notification
{
config_PutInt( VLCIntf->p_libvlc, "volume", i_lastShownVolume );
[self saveFrameUsingName: [self frameAutosaveName]];
}
- (void)someWindowWillClose:(NSNotification *)notification
{
if([notification object] == o_nonembedded_window || [notification object] == self)
[[VLCCoreInteraction sharedInstance] stop];
}
- (void)someWindowWillMiniaturize:(NSNotification *)notification
{
if([notification object] == o_nonembedded_window || [notification object] == self)
{
if([[VLCMain sharedInstance] activeVideoPlayback])
[[VLCCoreInteraction sharedInstance] pause];
}
}
#pragma mark -
#pragma mark Update interface and respond to foreign events
- (void)showDropZone
......@@ -1264,21 +1285,6 @@ static VLCMainWindow *_o_sharedInstance = nil;
[NSCursor setHiddenUntilMouseMoves: YES];
}
- (void)someWindowWillClose:(NSNotification *)notification
{
if([notification object] == o_nonembedded_window || [notification object] == self)
[[VLCCoreInteraction sharedInstance] stop];
}
- (void)someWindowWillMiniaturize:(NSNotification *)notification
{
if([notification object] == o_nonembedded_window || [notification object] == self)
{
if([[VLCMain sharedInstance] activeVideoPlayback])
[[VLCCoreInteraction sharedInstance] pause];
}
}
#pragma mark -
#pragma mark Fullscreen support
- (void)showFullscreenController
......
......@@ -678,6 +678,9 @@ static VLCMain *_o_sharedMainInstance = nil;
- (void)applicationWillTerminate:(NSNotification *)notification
{
if (notification == nil)
[[NSNotificationCenter defaultCenter] postNotificationName: NSApplicationWillTerminateNotification object: nil];
playlist_t * p_playlist;
vout_thread_t * p_vout;
int returnedValue = 0;
......
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