diff --git a/modules/gui/macosx/UI/VLCMainVideoView.xib b/modules/gui/macosx/UI/VLCMainVideoView.xib index 359e0fff8b..5469f63f9a 100644 --- a/modules/gui/macosx/UI/VLCMainVideoView.xib +++ b/modules/gui/macosx/UI/VLCMainVideoView.xib @@ -11,7 +11,10 @@ + + + diff --git a/modules/gui/macosx/windows/video/VLCMainVideoViewController.h b/modules/gui/macosx/windows/video/VLCMainVideoViewController.h index ed8e9489c0..0d7e63bcfd 100644 --- a/modules/gui/macosx/windows/video/VLCMainVideoViewController.h +++ b/modules/gui/macosx/windows/video/VLCMainVideoViewController.h @@ -34,6 +34,8 @@ NS_ASSUME_NONNULL_BEGIN @property (readwrite, strong) IBOutlet VLCControlsBarCommon *controlsBar; @property (readwrite, strong) IBOutlet NSButton *returnButton; @property (readwrite, strong) IBOutlet NSButton *playlistButton; +@property (readwrite, strong) IBOutlet NSLayoutConstraint *returnButtonTopConstraint; +@property (readwrite, strong) IBOutlet NSLayoutConstraint *playlistButtonTopConstraint; @property (readwrite, nonatomic) BOOL autohideControls; @property (readwrite, nonatomic) BOOL displayLibraryControls; diff --git a/modules/gui/macosx/windows/video/VLCMainVideoViewController.m b/modules/gui/macosx/windows/video/VLCMainVideoViewController.m index 12dbe5c290..8d76cda712 100644 --- a/modules/gui/macosx/windows/video/VLCMainVideoViewController.m +++ b/modules/gui/macosx/windows/video/VLCMainVideoViewController.m @@ -23,6 +23,7 @@ #import "VLCMainVideoViewController.h" #import "library/VLCLibraryWindow.h" +#import "library/VLCLibraryUIUnits.h" #import "main/VLCMain.h" @@ -53,6 +54,7 @@ [self setDisplayLibraryControls:[self.view.window class] == [VLCLibraryWindow class]]; [self updatePlaylistToggleState]; + [self updateLibraryControlsTopConstraint]; NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; [notificationCenter addObserver:self @@ -113,6 +115,7 @@ { [self stopAutohideTimer]; [self updatePlaylistToggleState]; + [self updateLibraryControlsTopConstraint]; if (!_mainControlsView.hidden && !_autohideControls) { return; @@ -146,6 +149,28 @@ } } +- (void)updateLibraryControlsTopConstraint +{ + const NSWindow * const viewWindow = self.view.window; + const NSView * const titlebarView = [viewWindow standardWindowButton:NSWindowCloseButton].superview; + const CGFloat windowTitlebarHeight = titlebarView.frame.size.height; + + const BOOL windowFullscreen = [(VLCWindow*)viewWindow isInNativeFullscreen] || [(VLCWindow*)viewWindow fullscreen]; + const CGFloat spaceToTitlebar = viewWindow.titlebarAppearsTransparent ? [VLCLibraryUIUnits smallSpacing] : [VLCLibraryUIUnits mediumSpacing]; + const CGFloat topSpaceWithTitlebar = windowTitlebarHeight + spaceToTitlebar; + + // Since the close/maximise/minimise buttons go on the left, we want to make sure the return + // button does not overlap. But for the playlist button, as long as the toolbar and titlebar + // appears fully transparent, it looks nicer to leave it at the top + const CGFloat returnButtonTopSpace = titlebarView.hidden || windowFullscreen ? + [VLCLibraryUIUnits mediumSpacing] : topSpaceWithTitlebar; + const CGFloat playlistButtonTopSpace = viewWindow.toolbar.visible && viewWindow.titlebarAppearsTransparent && !windowFullscreen ? + topSpaceWithTitlebar : [VLCLibraryUIUnits mediumSpacing]; + + _returnButtonTopConstraint.constant = returnButtonTopSpace; + _playlistButtonTopConstraint.constant = playlistButtonTopSpace; +} + - (IBAction)togglePlaylist:(id)sender { VLCLibraryWindow *libraryWindow = (VLCLibraryWindow*)self.view.window;