[vlc-commits] macosx: Restore FS panel position on same fullscreen device

David Fuhrmann git at videolan.org
Fri Feb 3 10:52:23 CET 2017


vlc | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Thu Feb  2 16:34:46 2017 +0100| [6df18384bc54b838d282009d31493ebdbabe4589] | committer: David Fuhrmann

macosx: Restore FS panel position on same fullscreen device

Save the last uses fullscreen rectangle to allow restoring the
same fullscreen controller position on next restart.

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

 modules/gui/macosx/VLCFSPanelController.m | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/modules/gui/macosx/VLCFSPanelController.m b/modules/gui/macosx/VLCFSPanelController.m
index 54ee756..0b4f499 100644
--- a/modules/gui/macosx/VLCFSPanelController.m
+++ b/modules/gui/macosx/VLCFSPanelController.m
@@ -42,12 +42,26 @@
 
 @implementation VLCFSPanelController
 
+static NSString *kAssociatedFullscreenRect = @"VLCFullscreenAssociatedWindowRect";
+
++ (void)initialize
+{
+    NSDictionary *appDefaults = [NSDictionary dictionaryWithObjectsAndKeys: NSStringFromRect(NSZeroRect), kAssociatedFullscreenRect, nil];
+
+    [[NSUserDefaults standardUserDefaults] registerDefaults:appDefaults];
+}
+
+
 #pragma mark -
 #pragma mark Initialization
 
 - (id)init
 {
     self = [super initWithWindowNibName:@"VLCFullScreenPanel"];
+    if (self) {
+        NSString *rectStr = [[NSUserDefaults standardUserDefaults] stringForKey:kAssociatedFullscreenRect];
+        _associatedVoutFrame = NSRectFromString(rectStr);
+    }
     return self;
 }
 
@@ -370,6 +384,8 @@
     NSRect voutRect = voutWindow.frame;
     if (!NSEqualRects(_associatedVoutFrame, voutRect)) {
         _associatedVoutFrame = voutRect;
+        [[NSUserDefaults standardUserDefaults] setObject:NSStringFromRect(_associatedVoutFrame) forKey:kAssociatedFullscreenRect];
+
         [self centerPanel];
     }
 



More information about the vlc-commits mailing list