[vlc-commits] [Git][videolan/vlc][master] 2 commits: macosx: Auto-hide main library window toolbar during video playback
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Mon Dec 12 08:55:43 UTC 2022
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
7bca0424 by Claudio Cambra at 2022-12-12T08:25:18+00:00
macosx: Auto-hide main library window toolbar during video playback
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
f026d5be by Claudio Cambra at 2022-12-12T08:25:18+00:00
macosx: Don't hide toolbar immediately on showing video, start timer instead
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
1 changed file:
- modules/gui/macosx/library/VLCLibraryWindow.m
Changes:
=====================================
modules/gui/macosx/library/VLCLibraryWindow.m
=====================================
@@ -82,6 +82,8 @@ static NSArray<NSLayoutConstraint *> *audioPlaceholderImageViewSizeConstraints;
NSInteger _currentSelectedSegment;
NSInteger _currentSelectedViewModeSegment;
+
+ NSTimer *_hideToolbarTimer;
}
- (IBAction)goToBrowseSection:(id)sender;
@@ -199,6 +201,10 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
selector:@selector(playerStateChanged:)
name:VLCPlayerStateChanged
object:nil];
+ [notificationCenter addObserver:self
+ selector:@selector(videoDisplayToolbar:)
+ name:VLCVideoWindowShouldShowFullscreenController
+ object:nil];
if (@available(macOS 10.14, *)) {
[[NSApplication sharedApplication] addObserver:self
@@ -759,6 +765,47 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
_windowFrameBeforePlayback = [self frame];
}
+- (void)startToolbarAutohideTimer
+{
+ /* Do nothing if timer is already in place */
+ if (_hideToolbarTimer.valid) {
+ return;
+ }
+
+ /* Get timeout and make sure it is not lower than 1 second */
+ long long timeToKeepVisibleInSec = MAX(var_CreateGetInteger(getIntf(), "mouse-hide-timeout") / 1000, 1);
+
+ _hideToolbarTimer = [NSTimer scheduledTimerWithTimeInterval:timeToKeepVisibleInSec
+ target:self
+ selector:@selector(videoHideToolbar:)
+ userInfo:nil
+ repeats:NO];
+}
+
+- (void)stopAutohideTimer
+{
+ [_hideToolbarTimer invalidate];
+}
+
+- (void)videoHideToolbar:(id)sender
+{
+ if (self.hasActiveVideo && !self.videoView.hidden) {
+ [self stopAutohideTimer];
+ self.toolbar.visible = NO;
+ }
+}
+
+- (void)videoDisplayToolbar:(id)sender
+{
+ [self stopAutohideTimer];
+
+ if (self.hasActiveVideo && !self.videoView.hidden) {
+ [self startToolbarAutohideTimer];
+ }
+
+ self.toolbar.visible = YES;
+}
+
- (void)setHasActiveVideo:(BOOL)hasActiveVideo
{
[super setHasActiveVideo:hasActiveVideo];
@@ -833,6 +880,8 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
[self hideControlsBar];
[_fspanel shouldBecomeActive:nil];
}
+
+ [self startToolbarAutohideTimer];
}
- (void)disableVideoPlaybackAppearance
@@ -861,6 +910,7 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
// restore alpha value to 1 for the case that macosx-opaqueness is set to < 1
[self setAlphaValue:1.0];
+ self.videoView.hidden = YES;
[self.segmentedTitleControl setHidden:NO];
[self.forwardsNavigationButton setHidden:NO];
@@ -877,6 +927,8 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
[self showControlsBar];
[_fspanel shouldBecomeInactive:nil];
}
+
+ [self videoDisplayToolbar:self];
}
#pragma mark -
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/3bb353e3c90c7e1402a2b3e24df737ca4b4dfd04...f026d5be5a990a24c85ad72c142793a3b90d8279
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/3bb353e3c90c7e1402a2b3e24df737ca4b4dfd04...f026d5be5a990a24c85ad72c142793a3b90d8279
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list