[vlc-commits] OSX GUI: simplify resizeWindow()

Rafaël Carré git at videolan.org
Wed Feb 15 22:27:37 CET 2012


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Wed Feb 15 16:25:43 2012 -0500| [20bfa22bb4f8ee7700aed026f9ea968a4699bbaa] | committer: Rafaël Carré

OSX GUI: simplify resizeWindow()

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

 modules/gui/macosx/MainWindow.m |   35 ++++++++++++++++-------------------
 1 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/modules/gui/macosx/MainWindow.m b/modules/gui/macosx/MainWindow.m
index 01d9180..f751eb7 100644
--- a/modules/gui/macosx/MainWindow.m
+++ b/modules/gui/macosx/MainWindow.m
@@ -1245,27 +1245,24 @@ static VLCMainWindow *_o_sharedInstance = nil;
 
 - (void)resizeWindow
 {
-    if ( !b_fullscreen && !(OSX_LION && [NSApp presentationOptions] == NSApplicationPresentationFullScreen && b_nativeFullscreenMode) )
-    {
-        NSPoint topleftbase;
-        NSPoint topleftscreen;
-        NSRect new_frame;
-        topleftbase.x = 0;
-        topleftbase.y = [self frame].size.height;
-        topleftscreen = [self convertBaseToScreen: topleftbase];
-
-        /* Calculate the window's new size */
-        new_frame.size.width = [self frame].size.width - [o_video_view frame].size.width + nativeVideoSize.width;
-        if (b_dark_interface)
-            new_frame.size.height = [self frame].size.height - [o_video_view frame].size.height + nativeVideoSize.height + [o_titlebar_view frame].size.height;
-        else
-            new_frame.size.height = [self frame].size.height - [o_video_view frame].size.height + nativeVideoSize.height;
+    if ( b_fullscreen || (OSX_LION && [NSApp presentationOptions] == NSApplicationPresentationFullScreen && b_nativeFullscreenMode) )
+        return;
 
-        new_frame.origin.x = topleftscreen.x;
-        new_frame.origin.y = topleftscreen.y - new_frame.size.height;
+    NSPoint topleftbase = NSMakePoint(0, [self frame].size.height);
+    NSPoint topleftscreen = [self convertBaseToScreen: topleftbase];
 
-        [[self animator] setFrame:new_frame display:YES];
-    }
+    /* Calculate the window's new size */
+    float w = [self frame].size.width  - [o_video_view frame].size.width
+        + nativeVideoSize.width;
+    float h = [self frame].size.height - [o_video_view frame].size.height
+        + nativeVideoSize.height;
+
+    if (b_dark_interface)
+        h += [o_titlebar_view frame].size.height;
+
+    NSRect new_frame = NSMakeRect(topleftscreen.x, topleftscreen.y - h, w, h);
+
+    [[self animator] setFrame:new_frame display:YES];
 }
 
 - (void)setNativeVideoSize:(NSSize)size



More information about the vlc-commits mailing list