[vlc-commits] macosx: fix video view and bottom bar framings

David Fuhrmann git at videolan.org
Thu Apr 25 16:31:38 CEST 2013


vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Thu Apr 25 16:22:42 2013 +0200| [7f85575cbe9a6127da37feea164c8010884f8a3d] | committer: David Fuhrmann

macosx: fix video view and bottom bar framings

... to allow toggling between playlist and video view in lion
fullscreen mode.

close #8496

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

 modules/gui/macosx/ControlsBar.h |    2 ++
 modules/gui/macosx/ControlsBar.m |    5 +++++
 modules/gui/macosx/MainWindow.m  |   29 +++++++++++++++++++++--------
 modules/gui/macosx/Windows.m     |   31 +++++++++++++++++++------------
 4 files changed, 47 insertions(+), 20 deletions(-)

diff --git a/modules/gui/macosx/ControlsBar.h b/modules/gui/macosx/ControlsBar.h
index d477d21..a62cfb0 100644
--- a/modules/gui/macosx/ControlsBar.h
+++ b/modules/gui/macosx/ControlsBar.h
@@ -69,6 +69,8 @@
 
 @property (readonly) id bottomBarView;
 
+- (CGFloat)height;
+
 - (IBAction)play:(id)sender;
 - (IBAction)bwd:(id)sender;
 - (IBAction)fwd:(id)sender;
diff --git a/modules/gui/macosx/ControlsBar.m b/modules/gui/macosx/ControlsBar.m
index 36d3832..d310b1d 100644
--- a/modules/gui/macosx/ControlsBar.m
+++ b/modules/gui/macosx/ControlsBar.m
@@ -158,6 +158,11 @@
 
 }
 
+- (CGFloat)height
+{
+    return [o_bottombar_view frame].size.height;
+}
+
 #pragma mark -
 #pragma mark Button Actions
 
diff --git a/modules/gui/macosx/MainWindow.m b/modules/gui/macosx/MainWindow.m
index 07fc41a..1260c89 100644
--- a/modules/gui/macosx/MainWindow.m
+++ b/modules/gui/macosx/MainWindow.m
@@ -438,6 +438,11 @@ static VLCMainWindow *_o_sharedInstance = nil;
 
     [o_video_view setHidden: YES];
     [o_split_view setHidden: NO];
+    if ([self fullscreen]) {
+        [[o_controls_bar bottomBarView] setHidden: NO];
+        [o_fspanel setNonActive:nil];
+    }
+
     [self makeFirstResponder: nil];
 
 }
@@ -451,6 +456,10 @@ static VLCMainWindow *_o_sharedInstance = nil;
 
     [o_split_view setHidden: YES];
     [o_video_view setHidden: NO];
+    if ([self fullscreen]) {
+        [[o_controls_bar bottomBarView] setHidden: YES];
+        [o_fspanel setActive:nil];
+    }
 
     if ([[o_video_view subviews] count] > 0)
         [self makeFirstResponder: [[o_video_view subviews] objectAtIndex:0]];
@@ -467,11 +476,6 @@ static VLCMainWindow *_o_sharedInstance = nil;
     BOOL b_activeVideo = [[VLCMain sharedInstance] activeVideoPlayback];
     BOOL b_restored = NO;
 
-    // TODO: implement toggle playlist in this situation (triggerd via menu item).
-    // but for now we block this case, to avoid displaying only the half
-    if (b_nativeFullscreenMode && b_fullscreen && b_activeVideo && sender != nil)
-        return;
-
     BOOL b_have_alt_key = ([[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask) != 0;
     if (sender && [sender isKindOfClass: [NSMenuItem class]])
         b_have_alt_key = NO;
@@ -775,7 +779,12 @@ static VLCMainWindow *_o_sharedInstance = nil;
     [super windowWillEnterFullScreen:notification];
 
     // update split view frame after removing title bar
-    [o_split_view setFrame: [o_video_view frame]];
+    if (b_dark_interface) {
+        NSRect frame = [[self contentView] frame];
+        frame.origin.y += [o_controls_bar height];
+        frame.size.height -= [o_controls_bar height];
+        [o_split_view setFrame:frame];
+    }
 }
 
 - (void)windowWillExitFullScreen:(NSNotification *)notification
@@ -783,7 +792,11 @@ static VLCMainWindow *_o_sharedInstance = nil;
     [super windowWillExitFullScreen: notification];
 
     // update split view frame after readding title bar
-    [o_split_view setFrame: [o_video_view frame]];
+    if (b_dark_interface) {
+        NSRect frame = [o_split_view frame];
+        frame.size.height -= [o_titlebar_view frame].size.height;
+        [o_split_view setFrame:frame];
+    }
 }
 #pragma mark -
 #pragma mark Fullscreen support
@@ -793,7 +806,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
 
     id currentWindow = [NSApp keyWindow];
     if ([currentWindow respondsToSelector:@selector(hasActiveVideo)] && [currentWindow hasActiveVideo]) {
-        if ([currentWindow respondsToSelector:@selector(fullscreen)] && [currentWindow fullscreen]) {
+        if ([currentWindow respondsToSelector:@selector(fullscreen)] && [currentWindow fullscreen] && ![[currentWindow videoView] isHidden]) {
 
             if ([[VLCMain sharedInstance] activeVideoPlayback])
                 [o_fspanel fadeIn];
diff --git a/modules/gui/macosx/Windows.m b/modules/gui/macosx/Windows.m
index b213f9e..647b2b8 100644
--- a/modules/gui/macosx/Windows.m
+++ b/modules/gui/macosx/Windows.m
@@ -618,9 +618,9 @@
         }
     }
 
-    [o_video_view setFrame: [[self contentView] frame]];
+    if ([self hasActiveVideo])
+        [[VLCMainWindow sharedInstance] recreateHideMouseTimer];
 
-    [[VLCMainWindow sharedInstance] recreateHideMouseTimer];
     i_originalLevel = [self level];
     [[[VLCMain sharedInstance] voutController] updateWindowLevelForHelperWindows: NSNormalWindowLevel];
     [self setLevel:NSNormalWindowLevel];
@@ -636,9 +636,11 @@
         [self setFrame: winrect display:NO animate:NO];
     }
 
-    // TODO fix bottom bar status when vout just not visible, but there
-    if (![o_video_view isHidden])
+    [o_video_view setFrame: [[self contentView] frame]];
+    if (![o_video_view isHidden]) {
         [[o_controls_bar bottomBarView] setHidden: YES];
+    }
+    
 
     [self setMovableByWindowBackground: NO];
 }
@@ -654,7 +656,8 @@
 
     if ([self hasActiveVideo]) {
         [[[VLCMainWindow sharedInstance] fsPanel] setVoutWasUpdated: self];
-        [[[VLCMainWindow sharedInstance] fsPanel] setActive: nil];
+        if (![o_video_view isHidden])
+            [[[VLCMainWindow sharedInstance] fsPanel] setActive: nil];
     }
 
     NSArray *subviews = [[self videoView] subviews];
@@ -690,24 +693,28 @@
     if (b_dark_interface) {
         NSRect winrect;
         CGFloat f_titleBarHeight = [o_titlebar_view frame].size.height;
-        winrect = [self frame];
 
+        winrect = [o_video_view frame];
+        winrect.size.height -= f_titleBarHeight;
+        [o_video_view setFrame: winrect];
+
+        winrect = [self frame];
         [o_titlebar_view setFrame: NSMakeRect(0, winrect.size.height - f_titleBarHeight,
                                               winrect.size.width, f_titleBarHeight)];
         [[self contentView] addSubview: o_titlebar_view];
 
         winrect.size.height = winrect.size.height + f_titleBarHeight;
         [self setFrame: winrect display:NO animate:NO];
-        winrect = [o_video_view frame];
-        winrect.size.height -= f_titleBarHeight;
-        [o_video_view setFrame: winrect];
     }
 
     NSRect videoViewFrame = [o_video_view frame];
-    videoViewFrame.origin.y = [[o_controls_bar bottomBarView] frame].size.height;
-    videoViewFrame.size.height -= [[o_controls_bar bottomBarView] frame].size.height;
+    videoViewFrame.origin.y += [o_controls_bar height];
+    videoViewFrame.size.height -= [o_controls_bar height];
     [o_video_view setFrame: videoViewFrame];
-    [[o_controls_bar bottomBarView] setHidden: NO];
+
+    if (![o_video_view isHidden]) {
+        [[o_controls_bar bottomBarView] setHidden: NO];
+    }
     
     [self setMovableByWindowBackground: YES];
 }



More information about the vlc-commits mailing list