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

Rafaël Carré git at videolan.org
Thu Feb 16 01:02:56 CET 2012


vlc/vlc-2.0 | branch: master | Rafaël Carré <funman at videolan.org> | Wed Feb 15 16:25:43 2012 -0500| [cb8e90f307b817168d4fa1e1bf0df3ffa710777f] | committer: Felix Paul Kühne

OSX GUI: simplify resizeWindow()
(cherry picked from commit 20bfa22bb4f8ee7700aed026f9ea968a4699bbaa)

Signed-off-by: Felix Paul Kühne <fkuehne at videolan.org>

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

 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 2919c9c..585cb0c 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