Commit d0510312 authored by Felix Paul Kühne's avatar Felix Paul Kühne Committed by Jean-Baptiste Kempf

macosx: work-around incompatibility between custom code and Cocoa's own way of...

macosx: work-around incompatibility between custom code and Cocoa's own way of doing things (fixes #5722) and use animations when zooming the main window in black mode
(cherry picked from commit 99fb87d0ea60ba751a5c3eb88ff00cad139d8a7c)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 42fad58d
......@@ -113,7 +113,7 @@
NSSize nativeVideoSize;
NSInteger i_originalLevel;
NSString *o_previouslySavedFrame;
NSRect previousSavedFrame;
}
+ (VLCMainWindow *)sharedInstance;
......
......@@ -73,11 +73,13 @@ static VLCMainWindow *_o_sharedInstance = nil;
b_dark_interface = config_GetInt( VLCIntf, "macosx-interfacestyle" );
if (b_dark_interface)
{
#ifdef MAC_OS_X_VERSION_10_7
styleMask = NSBorderlessWindowMask | NSResizableWindowMask;
#else
styleMask = NSBorderlessWindowMask;
#endif
}
self = [super initWithContentRect:contentRect styleMask:styleMask
backing:backingType defer:flag];
......@@ -700,7 +702,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
* Felipe A. Rodriguez <far@ix.netcom.com>, Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Copyright (C) 1996 Free Software Foundation, Inc.
*/
- (NSRect) constrainFrameRect: (NSRect)frameRect toScreen: (NSScreen*)screen
- (NSRect) customConstrainFrameRect: (NSRect)frameRect toScreen: (NSScreen*)screen
{
NSRect screenRect = [screen visibleFrame];
float difference;
......@@ -764,7 +766,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
maxRect = [[self delegate] windowWillUseStandardFrame: self defaultFrame: maxRect];
}
maxRect = [self constrainFrameRect: maxRect toScreen: [self screen]];
maxRect = [self customConstrainFrameRect: maxRect toScreen: [self screen]];
// Compare the new frame with the current one
if ((abs(NSMaxX(maxRect) - NSMaxX(currentFrame)) < DIST)
......@@ -775,7 +777,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
// Already in zoomed mode, reset user frame, if stored
if ([self frameAutosaveName] != nil)
{
[self setFrameFromString: o_previouslySavedFrame];
[self setFrame: previousSavedFrame display: YES animate: YES];
[self saveFrameUsingName: [self frameAutosaveName]];
}
return;
......@@ -784,11 +786,10 @@ static VLCMainWindow *_o_sharedInstance = nil;
if ([self frameAutosaveName] != nil)
{
[self saveFrameUsingName: [self frameAutosaveName]];
[o_previouslySavedFrame release];
o_previouslySavedFrame = [[self stringWithSavedFrame] retain];
previousSavedFrame = [self frame];
}
[self setFrame: maxRect display: YES];
[self setFrame: maxRect display: YES animate: YES];
}
#pragma mark -
......
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