Commit 6df18384 authored by David Fuhrmann's avatar 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.
parent 559a682d
...@@ -42,12 +42,26 @@ ...@@ -42,12 +42,26 @@
@implementation VLCFSPanelController @implementation VLCFSPanelController
static NSString *kAssociatedFullscreenRect = @"VLCFullscreenAssociatedWindowRect";
+ (void)initialize
{
NSDictionary *appDefaults = [NSDictionary dictionaryWithObjectsAndKeys: NSStringFromRect(NSZeroRect), kAssociatedFullscreenRect, nil];
[[NSUserDefaults standardUserDefaults] registerDefaults:appDefaults];
}
#pragma mark - #pragma mark -
#pragma mark Initialization #pragma mark Initialization
- (id)init - (id)init
{ {
self = [super initWithWindowNibName:@"VLCFullScreenPanel"]; self = [super initWithWindowNibName:@"VLCFullScreenPanel"];
if (self) {
NSString *rectStr = [[NSUserDefaults standardUserDefaults] stringForKey:kAssociatedFullscreenRect];
_associatedVoutFrame = NSRectFromString(rectStr);
}
return self; return self;
} }
...@@ -370,6 +384,8 @@ ...@@ -370,6 +384,8 @@
NSRect voutRect = voutWindow.frame; NSRect voutRect = voutWindow.frame;
if (!NSEqualRects(_associatedVoutFrame, voutRect)) { if (!NSEqualRects(_associatedVoutFrame, voutRect)) {
_associatedVoutFrame = voutRect; _associatedVoutFrame = voutRect;
[[NSUserDefaults standardUserDefaults] setObject:NSStringFromRect(_associatedVoutFrame) forKey:kAssociatedFullscreenRect];
[self centerPanel]; [self centerPanel];
} }
......
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