[vlc-commits] macosx: save window position manually when using the dark interface style

Felix Paul Kühne git at videolan.org
Thu Dec 29 22:01:43 CET 2011


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Thu Dec 29 20:17:09 2011 +0100| [d34151556967e2576af8e7ee2b89ddaed5085148] | committer: Felix Paul Kühne

macosx: save window position manually when using the dark interface style

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d34151556967e2576af8e7ee2b89ddaed5085148
---

 modules/gui/macosx/MainWindow.h |    1 +
 modules/gui/macosx/MainWindow.m |    9 +++++++++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/modules/gui/macosx/MainWindow.h b/modules/gui/macosx/MainWindow.h
index 1d06f41..2edad94 100644
--- a/modules/gui/macosx/MainWindow.h
+++ b/modules/gui/macosx/MainWindow.h
@@ -133,6 +133,7 @@
 
 - (void)setTitle:(NSString *)title;
 - (void) customZoom: (id)sender;
+- (void)windowResizedOrMoved:(NSNotification *)notification;
 
 - (void)showDropZone;
 - (void)hideDropZone;
diff --git a/modules/gui/macosx/MainWindow.m b/modules/gui/macosx/MainWindow.m
index 5e4a067..211b266 100644
--- a/modules/gui/macosx/MainWindow.m
+++ b/modules/gui/macosx/MainWindow.m
@@ -109,6 +109,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
 
 - (void)dealloc
 {
+    [[NSNotificationCenter defaultCenter] removeObserver: self];
     config_PutInt( VLCIntf->p_libvlc, "volume", i_lastShownVolume );
     [self saveFrameUsingName: [self frameAutosaveName]];
     [o_sidebaritems release];
@@ -394,6 +395,9 @@ static VLCMainWindow *_o_sharedInstance = nil;
 
     if( b_dark_interface )
     {
+        [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(windowResizedOrMoved:) name: NSWindowDidResizeNotification object: nil];
+        [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(windowResizedOrMoved:) name: NSWindowDidMoveNotification object: nil];
+
         NSRect winrect;
         CGFloat f_titleBarHeight = [o_titlebar_view frame].size.height;
         winrect = [self frame];
@@ -797,6 +801,11 @@ static VLCMainWindow *_o_sharedInstance = nil;
     [self setFrame: maxRect display: YES animate: YES];
 }
 
+- (void)windowResizedOrMoved:(NSNotification *)notification
+{
+    [self saveFrameUsingName: [self frameAutosaveName]];
+}
+
 #pragma mark -
 #pragma mark Update interface and respond to foreign events
 - (void)showDropZone



More information about the vlc-commits mailing list