[vlc-commits] macosx: make sure that NSApplicationWillTerminateNotification reaches all of its observers
Felix Paul Kühne
git at videolan.org
Sat Jan 21 22:21:01 CET 2012
vlc/vlc-1.2 | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Fri Jan 20 11:41:23 2012 -0800| [14e5e4c5f643aaaaf4b4226063993030090f49f4] | committer: Jean-Baptiste Kempf
macosx: make sure that NSApplicationWillTerminateNotification reaches all of its observers
(cherry picked from commit 3d7351e61608abf3aa724883aff20cff59b3b673)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.2.git/?a=commit;h=14e5e4c5f643aaaaf4b4226063993030090f49f4
---
modules/gui/macosx/MainWindow.m | 42 ++++++++++++++++++++++----------------
modules/gui/macosx/intf.m | 3 ++
2 files changed, 27 insertions(+), 18 deletions(-)
diff --git a/modules/gui/macosx/MainWindow.m b/modules/gui/macosx/MainWindow.m
index 3041196..7eb1b66 100644
--- a/modules/gui/macosx/MainWindow.m
+++ b/modules/gui/macosx/MainWindow.m
@@ -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
diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m
index db9d5c1..8ebadee 100644
--- a/modules/gui/macosx/intf.m
+++ b/modules/gui/macosx/intf.m
@@ -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;
More information about the vlc-commits
mailing list