]> git.sesse.net Git - vlc/commitdiff
macosx: fix video view and bottom bar framings
authorDavid Fuhrmann <david.fuhrmann@googlemail.com>
Thu, 25 Apr 2013 14:22:42 +0000 (16:22 +0200)
committerDavid Fuhrmann <david.fuhrmann@googlemail.com>
Thu, 25 Apr 2013 14:31:10 +0000 (16:31 +0200)
... to allow toggling between playlist and video view in lion
fullscreen mode.

close #8496

modules/gui/macosx/ControlsBar.h
modules/gui/macosx/ControlsBar.m
modules/gui/macosx/MainWindow.m
modules/gui/macosx/Windows.m

index d477d217849f087f842855d544a4eb81581f83be..a62cfb01f9d467c2bd7b1f085d0b2a195015c902 100644 (file)
@@ -69,6 +69,8 @@
 
 @property (readonly) id bottomBarView;
 
+- (CGFloat)height;
+
 - (IBAction)play:(id)sender;
 - (IBAction)bwd:(id)sender;
 - (IBAction)fwd:(id)sender;
index 36d383226f84d9ee472bb24aa457b6c807a1bb36..d310b1db98c6cda5a9fbd2a7d04de7d726672c11 100644 (file)
 
 }
 
+- (CGFloat)height
+{
+    return [o_bottombar_view frame].size.height;
+}
+
 #pragma mark -
 #pragma mark Button Actions
 
index 07fc41a7a7c9f3ae8f85479e7a83dd5ffb5d8792..1260c8959c9904cf5ed3c4b078824334dd657e26 100644 (file)
@@ -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];
index b213f9eec68b00f9d02096a5bfaa29376fa69406..647b2b894397dcf1c6774cfe919d0d2808d8ca9c 100644 (file)
         }
     }
 
-    [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];
         [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];
 }
 
     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];
     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];
 }