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

Felix Paul Kühne git at videolan.org
Fri Dec 30 12:40:20 CET 2011


vlc/vlc-1.2 | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Thu Dec 29 20:17:09 2011 +0100| [e557c7b8d975c5ed56b5ea89e2b487d75987d0b8] | committer: Jean-Baptiste Kempf

macosx: save window position manually when using the dark interface style
(cherry picked from commit d34151556967e2576af8e7ee2b89ddaed5085148)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 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 40920c8..24c377c 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