[vlc-commits] 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

Felix Paul Kühne git at videolan.org
Sun Dec 25 13:10:52 CET 2011


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Sun Dec 25 13:09:59 2011 +0100| [99fb87d0ea60ba751a5c3eb88ff00cad139d8a7c] | committer: Felix Paul Kühne

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

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

 modules/gui/macosx/MainWindow.h |    2 +-
 modules/gui/macosx/MainWindow.m |   13 +++++++------
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/modules/gui/macosx/MainWindow.h b/modules/gui/macosx/MainWindow.h
index 69f997f..67ee648 100644
--- a/modules/gui/macosx/MainWindow.h
+++ b/modules/gui/macosx/MainWindow.h
@@ -113,7 +113,7 @@
     NSSize nativeVideoSize;
 
     NSInteger i_originalLevel;
-    NSString *o_previouslySavedFrame;
+    NSRect previousSavedFrame;
 }
 + (VLCMainWindow *)sharedInstance;
 
diff --git a/modules/gui/macosx/MainWindow.m b/modules/gui/macosx/MainWindow.m
index fb3ff65..5c8cb39 100644
--- a/modules/gui/macosx/MainWindow.m
+++ b/modules/gui/macosx/MainWindow.m
@@ -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 at ix.netcom.com>, Richard Frith-Macdonald <richard at 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 -



More information about the vlc-commits mailing list