[vlc-commits] macosx: skip useless resize when starting video from minimal view ( close #9510)

David Fuhrmann git at videolan.org
Tue Oct 22 22:37:33 CEST 2013


vlc/vlc-2.1 | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Tue Oct 22 22:32:42 2013 +0200| [b0c82e8b9b7743985d9ebbc36cf68dc69ccf3bcf] | committer: David Fuhrmann

macosx: skip useless resize when starting video from minimal view (close #9510)
(cherry picked from commit cdb1a7b649de2a4881dac886e5a8ec64d59e9384)

Signed-off-by: David Fuhrmann <david.fuhrmann at googlemail.com>

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

 modules/gui/macosx/MainWindow.h |    2 --
 modules/gui/macosx/MainWindow.m |   35 ++++++++++++++++++++---------------
 2 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/modules/gui/macosx/MainWindow.h b/modules/gui/macosx/MainWindow.h
index 112e7b3..528efee 100644
--- a/modules/gui/macosx/MainWindow.h
+++ b/modules/gui/macosx/MainWindow.h
@@ -119,8 +119,6 @@
 - (void)toggleLeftSubSplitView;
 - (void)showDropZone;
 - (void)hideDropZone;
-- (void)showSplitView;
-- (void)hideSplitView;
 - (void)updateTimeSlider;
 - (void)updateWindow;
 - (void)updateName;
diff --git a/modules/gui/macosx/MainWindow.m b/modules/gui/macosx/MainWindow.m
index 3fb64a6..9fa9828 100644
--- a/modules/gui/macosx/MainWindow.m
+++ b/modules/gui/macosx/MainWindow.m
@@ -373,7 +373,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
     [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(mainSplitViewDidResizeSubviews:) name: NSSplitViewDidResizeSubviewsNotification object:o_split_view];
 
     if (b_splitviewShouldBeHidden) {
-        [self hideSplitView];
+        [self hideSplitView: YES];
         i_lastSplitViewHeight = 300;
     }
 
@@ -488,11 +488,11 @@ static VLCMainWindow *_o_sharedInstance = nil;
                                                                               || (b_nonembedded && sender != nil)
                                                                               || (!b_activeVideo && sender != nil)
                                                                               || b_minimized_view))
-        [self hideSplitView];
+        [self hideSplitView: sender != nil];
     else {
         if (b_splitview_removed) {
             if (!b_nonembedded || (sender != nil && b_nonembedded))
-                [self showSplitView];
+                [self showSplitView: sender != nil];
 
             if (sender == nil)
                 b_minimized_view = YES;
@@ -577,13 +577,16 @@ static VLCMainWindow *_o_sharedInstance = nil;
     [[o_playlist_table animator] setHidden: NO];
 }
 
-- (void)hideSplitView
+- (void)hideSplitView:(BOOL)b_with_resize
 {
-    NSRect winrect = [self frame];
-    i_lastSplitViewHeight = [o_split_view frame].size.height;
-    winrect.size.height = winrect.size.height - i_lastSplitViewHeight;
-    winrect.origin.y = winrect.origin.y + i_lastSplitViewHeight;
-    [self setFrame: winrect display: YES animate: YES];
+    if (b_with_resize) {
+        NSRect winrect = [self frame];
+        i_lastSplitViewHeight = [o_split_view frame].size.height;
+        winrect.size.height = winrect.size.height - i_lastSplitViewHeight;
+        winrect.origin.y = winrect.origin.y + i_lastSplitViewHeight;
+        [self setFrame: winrect display: YES animate: YES];
+    }
+
     [self performSelector:@selector(hideDropZone) withObject:nil afterDelay:0.1];
     if (b_dark_interface) {
         [self setContentMinSize: NSMakeSize(604., [o_controls_bar height] + [o_titlebar_view frame].size.height)];
@@ -596,7 +599,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
     b_splitview_removed = YES;
 }
 
-- (void)showSplitView
+- (void)showSplitView:(BOOL)b_with_resize
 {
     [self updateWindow];
     if (b_dark_interface)
@@ -605,11 +608,13 @@ static VLCMainWindow *_o_sharedInstance = nil;
         [self setContentMinSize:NSMakeSize(604., 288.)];
     [self setContentMaxSize: NSMakeSize(FLT_MAX, FLT_MAX)];
 
-    NSRect winrect;
-    winrect = [self frame];
-    winrect.size.height = winrect.size.height + i_lastSplitViewHeight;
-    winrect.origin.y = winrect.origin.y - i_lastSplitViewHeight;
-    [self setFrame: winrect display: YES animate: YES];
+    if (b_with_resize) {
+        NSRect winrect;
+        winrect = [self frame];
+        winrect.size.height = winrect.size.height + i_lastSplitViewHeight;
+        winrect.origin.y = winrect.origin.y - i_lastSplitViewHeight;
+        [self setFrame: winrect display: YES animate: YES];
+    }
 
     [self performSelector:@selector(resizePlaylistAfterCollapse) withObject: nil afterDelay:0.75];
 



More information about the vlc-commits mailing list