vlc/vlc-3.0 | branch: master | David Fuhrmann <dfuhrm...@videolan.org> | Wed 
Jan 15 21:50:00 2020 +0100| [c6f0441908a131960e6bb6a96660a88b76d34336] | 
committer: David Fuhrmann

macosx: Refine animations to show and hide the fullscreen controller

Previously, the fs panel was fading in with a 400ms animation, and
at the same time the 1s timer to hide the panel has started.
This led to a percieved visibility of the panel for only 600 ms approx,
which felt a bit too short as a default value.

Now only start the timer once the animation is fully complete, and
avoid repeated abortions of this animation.

(cherry picked from commit 6dcf70b7c3ae71fc88dc83fd4faa0e3122701af3)
Signed-off-by: David Fuhrmann <dfuhrm...@videolan.org>

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

 modules/gui/macosx/VLCFSPanelController.m | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/modules/gui/macosx/VLCFSPanelController.m 
b/modules/gui/macosx/VLCFSPanelController.m
index db76397470..61c82f4603 100644
--- a/modules/gui/macosx/VLCFSPanelController.m
+++ b/modules/gui/macosx/VLCFSPanelController.m
@@ -31,6 +31,7 @@
 
 @interface VLCFSPanelController () {
     BOOL _isCounting;
+    BOOL _isFadingIn;
 
     // Only used to track changes and trigger centering of FS panel
     NSRect _associatedVoutFrame;
@@ -324,20 +325,26 @@ static NSString *kAssociatedFullscreenRect = 
@"VLCFullscreenAssociatedWindowRect
     if (!var_InheritBool(getIntf(), "macosx-fspanel"))
         return;
 
-    [NSAnimationContext beginGrouping];
-    [[NSAnimationContext currentContext] setDuration:0.4f];
-    [[self.window animator] setAlphaValue:1.0f];
-    [NSAnimationContext endGrouping];
+    if (_isFadingIn)
+        return;
 
-    [self startAutohideTimer];
+    [self stopAutohideTimer];
+    [NSAnimationContext runAnimationGroup:^(NSAnimationContext * _Nonnull 
context) {
+        _isFadingIn = YES;
+        [context setDuration:0.4f];
+        [[self.window animator] setAlphaValue:1.0f];
+    } completionHandler:^{
+        _isFadingIn = NO;
+        [self startAutohideTimer];
+    }];
 }
 
 - (void)fadeOut
 {
-    [NSAnimationContext beginGrouping];
-    [[NSAnimationContext currentContext] setDuration:0.4f];
-    [[self.window animator] setAlphaValue:0.0f];
-    [NSAnimationContext endGrouping];
+    [NSAnimationContext runAnimationGroup:^(NSAnimationContext * _Nonnull 
context) {
+        [context setDuration:0.4f];
+        [[self.window animator] setAlphaValue:0.0f];
+    } completionHandler:nil];
 }
 
 - (void)centerPanel

_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to