[vlc-commits] [Git][videolan/vlc][master] 2 commits: macosx: Add NSAnimationContext extension file

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Mon Jun 22 07:38:33 UTC 2026



Felix Paul Kühne pushed to branch master at VideoLAN / VLC


Commits:
89d125ba by joseanemsilva at 2026-06-22T09:24:33+02:00
macosx: Add NSAnimationContext extension file

This extension is implemented to add support to reduce motion user preferences.

- - - - -
85d4a807 by joseanemsilva at 2026-06-22T09:24:33+02:00
macosx: Use the new accessibility reduce motion extension

Change modules animation to use the NSAnimationContext extension
to respect user accessibility preferences.

- - - - -


14 changed files:

- modules/gui/macosx/Makefile.am
- + modules/gui/macosx/extensions/NSAnimationContext+VLCAdditions.h
- + modules/gui/macosx/extensions/NSAnimationContext+VLCAdditions.m
- modules/gui/macosx/library/VLCLibraryCollectionViewFlowLayout.m
- modules/gui/macosx/library/VLCLibraryWindow.m
- modules/gui/macosx/library/VLCLibraryWindowNavigationSidebarViewController.m
- modules/gui/macosx/views/VLCTrackingView.m
- modules/gui/macosx/views/iCarousel/iCarousel.m
- modules/gui/macosx/windows/VLCOpenWindowController.m
- modules/gui/macosx/windows/video/VLCFullVideoViewWindow.m
- modules/gui/macosx/windows/video/VLCMainVideoViewController.m
- modules/gui/macosx/windows/video/VLCVideoOutputProvider.m
- modules/gui/macosx/windows/video/VLCVideoWindowCommon.m
- modules/gui/macosx/windows/video/VLCWindow.m


Changes:

=====================================
modules/gui/macosx/Makefile.am
=====================================
@@ -98,6 +98,8 @@ libmacosx_plugin_la_SOURCES = \
 	gui/macosx/coreinteraction/VLCHotkeysController.m \
 	gui/macosx/coreinteraction/VLCVideoFilterHelper.h \
 	gui/macosx/coreinteraction/VLCVideoFilterHelper.m \
+	gui/macosx/extensions/NSAnimationContext+VLCAdditions.h \
+	gui/macosx/extensions/NSAnimationContext+VLCAdditions.m \
 	gui/macosx/extensions/NSArray+VLCAdditions.h \
 	gui/macosx/extensions/NSArray+VLCAdditions.m \
 	gui/macosx/extensions/NSGradient+VLCAdditions.h \


=====================================
modules/gui/macosx/extensions/NSAnimationContext+VLCAdditions.h
=====================================
@@ -0,0 +1,38 @@
+/*****************************************************************************
+ * NSAnimationContext+VLCAdditions.h MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2026 VLC authors and VideoLAN
+ *
+ * Authors: Joseane Silva
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#import <Cocoa/Cocoa.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+ at interface NSAnimationContext (VLCAdditions)
+
++ (void)runAnimationRespectingPreferencesWithDuration:(NSTimeInterval)duration
+                                              changes:(void (^)(NSAnimationContext *))changes
+                                    completionHandler:(nullable void (^)())completionHandler;
+
++ (void)runAnimationRespectingPreferencesWithChanges:(void (^)(NSAnimationContext *))changes
+                                   completionHandler:(nullable void (^)())completionHandler;
+
+ at end
+
+NS_ASSUME_NONNULL_END
\ No newline at end of file


=====================================
modules/gui/macosx/extensions/NSAnimationContext+VLCAdditions.m
=====================================
@@ -0,0 +1,58 @@
+/*****************************************************************************
+ * NSAnimationContext+VLCAdditions.m MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2026 VLC authors and VideoLAN
+ *
+ * Authors: Joseane Silva
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#import "NSAnimationContext+VLCAdditions.h"
+
+ at implementation NSAnimationContext (VLCAdditions)
+
++ (void)runAnimationRespectingPreferences:(NSNumber *)duration
+                                  changes:(void (^)(NSAnimationContext *))changes
+                        completionHandler:(nullable void (^)())completionHandler
+{
+    const BOOL reduceMotion = NSWorkspace.sharedWorkspace.accessibilityDisplayShouldReduceMotion;
+
+    [NSAnimationContext runAnimationGroup:^(NSAnimationContext *const context){
+        if (duration != nil) {
+            context.duration = reduceMotion ? 0 : duration.doubleValue;
+        }
+        changes(context);
+    } completionHandler:completionHandler];
+}
+
++ (void)runAnimationRespectingPreferencesWithDuration:(NSTimeInterval)duration
+                                              changes:(void (^)(NSAnimationContext *))changes
+                                    completionHandler:(nullable void (^)())completionHandler
+{
+    [self runAnimationRespectingPreferences:@(duration)
+                                    changes:changes
+                          completionHandler:completionHandler];
+}
+
++ (void)runAnimationRespectingPreferencesWithChanges:(void (^)(NSAnimationContext *))changes
+                                   completionHandler:(nullable void (^)())completionHandler
+{
+    [self runAnimationRespectingPreferences:nil
+                                    changes:changes
+                          completionHandler:completionHandler];
+}
+
+ at end
\ No newline at end of file


=====================================
modules/gui/macosx/library/VLCLibraryCollectionViewFlowLayout.m
=====================================
@@ -22,6 +22,8 @@
 
 #import "VLCLibraryCollectionViewFlowLayout.h"
 
+#import "extensions/NSAnimationContext+VLCAdditions.h"
+
 #import "library/VLCLibraryCollectionViewDataSource.h"
 #import "library/VLCLibraryCollectionViewMediaItemSupplementaryDetailView.h"
 #import "library/VLCLibraryCollectionViewMediaItemListSupplementaryDetailView.h"
@@ -192,7 +194,10 @@ static CVReturn detailViewAnimationCallback(CVDisplayLinkRef displayLink,
 
         NSRect frame = [self.collectionView layoutAttributesForItemAtIndexPath:indexPath].frame;
         frame.size.height += [self finalExpandedHeight] + VLCLibraryUIUnits.largeSpacing;
-        [self.collectionView.animator scrollRectToVisible:frame];
+
+        [NSAnimationContext runAnimationRespectingPreferencesWithChanges:^(NSAnimationContext * const __unused context) {
+            [self.collectionView.animator scrollRectToVisible:frame];
+        } completionHandler:nil];
     } else {
         _animationIsCollapse = NO;
         


=====================================
modules/gui/macosx/library/VLCLibraryWindow.m
=====================================
@@ -24,6 +24,7 @@
 
 #import "VLCLibraryDataTypes.h"
 
+#import "extensions/NSAnimationContext+VLCAdditions.h"
 #import "extensions/NSColor+VLCAdditions.h"
 #import "extensions/NSImage+VLCAdditions.h"
 #import "extensions/NSFont+VLCAdditions.h"
@@ -554,9 +555,9 @@ static int ShowController(vlc_object_t * __unused p_this,
 
 - (void)hideControlsBar
 {
-    [NSAnimationContext runAnimationGroup:^(NSAnimationContext * const context) {
+     [NSAnimationContext runAnimationRespectingPreferencesWithDuration:VLCLibraryUIUnits.controlsFadeAnimationDuration
+                                                               changes:^(NSAnimationContext * const context) {
         context.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
-        context.duration = VLCLibraryUIUnits.controlsFadeAnimationDuration;
         self.controlsBar.bottomBarView.animator.alphaValue = 0;
     } completionHandler:^{
         self.controlsBar.bottomBarView.hidden = self.controlsBar.bottomBarView.alphaValue == 0;
@@ -572,9 +573,10 @@ static int ShowController(vlc_object_t * __unused p_this,
 - (void)showControlsBar
 {
     self.controlsBar.bottomBarView.hidden = NO;
-    [NSAnimationContext runAnimationGroup:^(NSAnimationContext * const context) {
+
+    [NSAnimationContext runAnimationRespectingPreferencesWithDuration:VLCLibraryUIUnits.controlsFadeAnimationDuration
+                                                              changes:^(NSAnimationContext * const context) {
         context.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn];
-        context.duration = VLCLibraryUIUnits.controlsFadeAnimationDuration;
         self.controlsBar.bottomBarView.animator.alphaValue = 1;
     } completionHandler:nil];
 }
@@ -713,10 +715,11 @@ static int ShowController(vlc_object_t * __unused p_this,
     self.libraryTargetView.subviews = views;
     [self.loadingOverlayView applyConstraintsToFillSuperview];
 
-    [NSAnimationContext runAnimationGroup:^(NSAnimationContext * const context) {
-        context.duration = 0.5;
+    [NSAnimationContext runAnimationRespectingPreferencesWithDuration:0.5
+                                                              changes:^(NSAnimationContext * const context) {
         self.loadingOverlayView.animator.alphaValue = 1.0;
     } completionHandler:nil];
+
     [self.loadingOverlayView.indicator startAnimation:self];
 
 }
@@ -732,8 +735,8 @@ static int ShowController(vlc_object_t * __unused p_this,
     self.loadingOverlayView.wantsLayer = YES;
     self.loadingOverlayView.alphaValue = 1.0;
 
-    [NSAnimationContext runAnimationGroup:^(NSAnimationContext * const context) {
-        context.duration = 1.0;
+    [NSAnimationContext runAnimationRespectingPreferencesWithDuration:1.0
+                                                              changes:^(NSAnimationContext * const context) {
         self.loadingOverlayView.animator.alphaValue = 0.0;
     } completionHandler:^{
         NSMutableArray * const mutableSubviews = self.libraryTargetView.subviews.mutableCopy;


=====================================
modules/gui/macosx/library/VLCLibraryWindowNavigationSidebarViewController.m
=====================================
@@ -34,6 +34,7 @@
 
 #import "main/VLCMain.h"
 
+#import "extensions/NSAnimationContext+VLCAdditions.h"
 #import "extensions/NSColor+VLCAdditions.h"
 #import "extensions/NSWindow+VLCAdditions.h"
 
@@ -238,12 +239,15 @@ static NSString * const VLCLibrarySegmentCellIdentifier = @"VLCLibrarySegmentCel
                          self.scrollViewInsets.bottom + statusNotifierHeight,
                          self.scrollViewInsets.right);
     self.statusNotifierView.hidden = NO;
-    self.statusNotifierView.animator.alphaValue = 1.0;
+
+    [NSAnimationContext runAnimationRespectingPreferencesWithChanges:^(NSAnimationContext * const __unused context) {
+        self.statusNotifierView.animator.alphaValue = 1.0;
+    } completionHandler:nil];
 }
 
 - (void)statusViewDeactivated:(NSNotification *)notification
 {
-    [NSAnimationContext runAnimationGroup:^(NSAnimationContext * const __unused context) {
+    [NSAnimationContext runAnimationRespectingPreferencesWithChanges:^(NSAnimationContext * const __unused context) {
         self.statusNotifierView.animator.alphaValue = 0.0;
     } completionHandler:^{
         self.statusNotifierView.hidden = YES;


=====================================
modules/gui/macosx/views/VLCTrackingView.m
=====================================
@@ -22,6 +22,8 @@
 
 #import "VLCTrackingView.h"
 
+#import "extensions/NSAnimationContext+VLCAdditions.h"
+
 @interface VLCTrackingView ()
 {
     NSTrackingArea *_trackingArea;
@@ -91,8 +93,8 @@
             view.hidden = NO;
         }
 
-        [NSAnimationContext runAnimationGroup:^(NSAnimationContext * const context){
-            NSAnimationContext.currentContext.duration = 0.3;
+        [NSAnimationContext runAnimationRespectingPreferencesWithDuration:0.3
+                                                                  changes:^(NSAnimationContext * const context) {
             for (NSView * const view in weakSelf.viewsToHide) {
                 view.animator.alphaValue = hideVTH ? 0.0 : 1.0;
             }


=====================================
modules/gui/macosx/views/iCarousel/iCarousel.m
=====================================
@@ -1646,8 +1646,9 @@ NSComparisonResult compareViewDepth(UIView *view1, UIView *view2, iCarousel *sel
     UIView *containerView = [[self itemViewAtIndex:index] superview];
     if (containerView)
     {
-        if (animated)
-        {
+        const BOOL reduceMotion = NSWorkspace.sharedWorkspace.accessibilityDisplayShouldReduceMotion;
+
+        if (animated && !reduceMotion) {
             //fade transition
             CATransition *transition = [CATransition animation];
             transition.duration = INSERT_DURATION;


=====================================
modules/gui/macosx/windows/VLCOpenWindowController.m
=====================================
@@ -27,6 +27,7 @@
 #import "VLCOpenWindowController.h"
 
 #import <Cocoa/Cocoa.h>
+#import "extensions/NSAnimationContext+VLCAdditions.h"
 #import "extensions/NSImage+VLCAdditions.h"
 #import <AVFoundation/AVFoundation.h>
 
@@ -503,13 +504,15 @@ NSString *const VLCOpenTextFieldWasClicked = @"VLCOpenTextFieldWasClicked";
 
 - (IBAction)expandMRLfieldAction:(id)sender
 {
-    if ([_mrlButton state] == NSOffState) {
-        self.mrlViewHeightConstraint.animator.constant = 0;
-        self.mrlBox.hidden = YES;
-    } else {
-        self.mrlViewHeightConstraint.animator.constant = 39;
-        self.mrlBox.hidden = NO;
-    }
+    [NSAnimationContext runAnimationRespectingPreferencesWithChanges:^(NSAnimationContext * const __unused context) {
+        if ([_mrlButton state] == NSOffState) {
+            self.mrlViewHeightConstraint.animator.constant = 0;
+            self.mrlBox.hidden = YES;
+        } else {
+            self.mrlViewHeightConstraint.animator.constant = 39;
+            self.mrlBox.hidden = NO;
+        }
+    } completionHandler: nil];
 }
 
 - (void)openFileGeneric


=====================================
modules/gui/macosx/windows/video/VLCFullVideoViewWindow.m
=====================================
@@ -24,6 +24,8 @@
 
 #import "VLCMainVideoViewController.h"
 
+#import "extensions/NSAnimationContext+VLCAdditions.h"
+
 #import "library/VLCLibraryUIUnits.h"
 
 #import "main/VLCMain.h"
@@ -91,9 +93,9 @@
         return;
     }
 
-    [NSAnimationContext runAnimationGroup:^(NSAnimationContext * _Nonnull context) {
+    [NSAnimationContext runAnimationRespectingPreferencesWithDuration:VLCLibraryUIUnits.controlsFadeAnimationDuration
+                                                              changes:^(NSAnimationContext * const _Nonnull context){
         self->_isFadingIn = YES;
-        [context setDuration:VLCLibraryUIUnits.controlsFadeAnimationDuration];
         [titlebarView.animator setAlphaValue:1.0f];
     } completionHandler:^{
         self->_isFadingIn = NO;
@@ -117,8 +119,8 @@
 
     NSView *titlebarView = [self standardWindowButton:NSWindowCloseButton].superview;
 
-    [NSAnimationContext runAnimationGroup:^(NSAnimationContext * _Nonnull context) {
-        [context setDuration:VLCLibraryUIUnits.controlsFadeAnimationDuration];
+    [NSAnimationContext runAnimationRespectingPreferencesWithDuration:VLCLibraryUIUnits.controlsFadeAnimationDuration
+                                                              changes:^(NSAnimationContext * const _Nonnull context) {
         [titlebarView.animator setAlphaValue:0.0f];
     } completionHandler:nil];
 }


=====================================
modules/gui/macosx/windows/video/VLCMainVideoViewController.m
=====================================
@@ -23,6 +23,7 @@
 
 #import "VLCMainVideoViewController.h"
 
+#import "extensions/NSAnimationContext+VLCAdditions.h"
 #import "extensions/NSView+VLCAdditions.h"
 #import "extensions/NSWindow+VLCAdditions.h"
 
@@ -461,8 +462,8 @@ NSString * const VLCUseClassicVideoPlayerLayoutKey = @"VLCUseClassicVideoPlayerL
         self.videoViewBottomToViewConstraint.active = YES;
     }
 
-    [NSAnimationContext runAnimationGroup:^(NSAnimationContext * _Nonnull context) {
-        [context setDuration:VLCLibraryUIUnits.controlsFadeAnimationDuration];
+    [NSAnimationContext runAnimationRespectingPreferencesWithDuration:VLCLibraryUIUnits.controlsFadeAnimationDuration
+                                                              changes:^(NSAnimationContext * const _Nonnull context) {
         [self->_mainControlsView.animator setAlphaValue:0.0f];
         [self->_floatOnTopIndicatorImageView.animator setAlphaValue:0.0f];
     } completionHandler:nil];
@@ -508,9 +509,10 @@ NSString * const VLCUseClassicVideoPlayerLayoutKey = @"VLCUseClassicVideoPlayerL
         return;
     }
 
-    [NSAnimationContext runAnimationGroup:^(NSAnimationContext * _Nonnull context) {
+
+    [NSAnimationContext runAnimationRespectingPreferencesWithDuration:VLCLibraryUIUnits.controlsFadeAnimationDuration
+                                                              changes:^(NSAnimationContext * const _Nonnull context) {
         self->_isFadingIn = YES;
-        [context setDuration:VLCLibraryUIUnits.controlsFadeAnimationDuration];
         [self->_mainControlsView.animator setAlphaValue:1.0f];
         [self->_floatOnTopIndicatorImageView.animator setAlphaValue:1.0f];
     } completionHandler:^{


=====================================
modules/gui/macosx/windows/video/VLCVideoOutputProvider.m
=====================================
@@ -23,6 +23,7 @@
 
 #import "VLCVideoOutputProvider.h"
 
+#import "extensions/NSAnimationContext+VLCAdditions.h"
 #import "extensions/NSScreen+VLCAdditions.h"
 
 #import "library/VLCLibraryDataTypes.h"
@@ -462,16 +463,14 @@ static int WindowFloatOnTop(vlc_object_t *obj,
     BOOL videoWallpaper = var_InheritBool(getIntf(), "video-wallpaper") && !multipleVoutWindows;
 
     // Avoid flashes if video will directly start in fullscreen
-    [NSAnimationContext beginGrouping];
-
-    if (!videoWallpaper) {
-        [self setupPositionAndSizeForVideoWindow:newVideoWindow atPosition:videoViewPosition];
-    }
-
-    [self setupVideoOutputForVideoWindow:newVideoWindow withVlcWindow:p_wnd];
-    [self setupFullscreenStartIfNeededForVout:voutView withVlcWindow:p_wnd];
+    [NSAnimationContext runAnimationRespectingPreferencesWithChanges:^(NSAnimationContext * const __unused context) {
+        if (!videoWallpaper) {
+            [self setupPositionAndSizeForVideoWindow:newVideoWindow atPosition:videoViewPosition];
+        }
+        [self setupVideoOutputForVideoWindow:newVideoWindow withVlcWindow:p_wnd];
+        [self setupFullscreenStartIfNeededForVout:voutView withVlcWindow:p_wnd];
+    } completionHandler:nil];
 
-    [NSAnimationContext endGrouping];
     return voutView;
 }
 
@@ -539,34 +538,34 @@ static int WindowFloatOnTop(vlc_object_t *obj,
     }
 
     // prevent visible extra window if in fullscreen
-    [NSAnimationContext beginGrouping];
-    const BOOL b_native = var_InheritBool(getIntf(), "macosx-nativefullscreenmode");
-
-    // close fullscreen, without changing fullscreen vars
-    if (!b_native && (videoWindow.fullscreen || videoWindow.inFullscreenTransition))
-        [videoWindow leaveFullscreenWithAnimation:NO];
-
-    // native fullscreen window will not be closed if
-    // fullscreen was triggered without video
-    if (b_native
-        && videoWindow.class == VLCLibraryWindow.class
-        && videoWindow.fullscreen
-        && videoWindow.windowShouldExitFullscreenWhenFinished) {
-        [videoWindow toggleFullScreen:self];
-    }
-
-    if (videoWindow.class == VLCLibraryWindow.class) {
-        // If `embeddedVideoPlaybackActive` is already `NO`, the user navigated back
-        // while playback was ongoing - `disableVideoPlaybackAppearance` was already
-        // called at that point, so nothing more to do here.
+    [NSAnimationContext runAnimationRespectingPreferencesWithChanges:^(NSAnimationContext * const __unused context) {
+        const BOOL b_native = var_InheritBool(getIntf(), "macosx-nativefullscreenmode");
+
+        // close fullscreen, without changing fullscreen vars
+        if (!b_native && (videoWindow.fullscreen || videoWindow.inFullscreenTransition))
+            [videoWindow leaveFullscreenWithAnimation:NO];
+
+        // native fullscreen window will not be closed if
+        // fullscreen was triggered without video
+        if (b_native
+            && videoWindow.class == VLCLibraryWindow.class
+            && videoWindow.fullscreen
+            && videoWindow.windowShouldExitFullscreenWhenFinished) {
+            [videoWindow toggleFullScreen:self];
+        }
+
+        if (videoWindow.class == VLCLibraryWindow.class) {
+            // If `embeddedVideoPlaybackActive` is already `NO`, the user navigated back
+            // while playback was ongoing - `disableVideoPlaybackAppearance` was already
+            // called at that point, so nothing more to do here.
         
-        if (((VLCLibraryWindow *)videoWindow).embeddedVideoPlaybackActive) {
-            [(VLCLibraryWindow *)videoWindow disableVideoPlaybackAppearance];
+            if (((VLCLibraryWindow *)videoWindow).embeddedVideoPlaybackActive) {
+                [(VLCLibraryWindow *)videoWindow disableVideoPlaybackAppearance];
+            }
+        } else {
+            [videoWindow close];
         }
-    } else {
-        [videoWindow close];
-    }
-    [NSAnimationContext endGrouping];
+    } completionHandler:nil];
 
     [_voutWindows removeObjectForKey:key];
     if (_voutWindows.count == 0) {


=====================================
modules/gui/macosx/windows/video/VLCVideoWindowCommon.m
=====================================
@@ -23,6 +23,7 @@
 
 #import "VLCVideoWindowCommon.h"
 
+#import "extensions/NSAnimationContext+VLCAdditions.h"
 #import "extensions/NSScreen+VLCAdditions.h"
 #import "extensions/NSString+Helpers.h"
 
@@ -233,8 +234,8 @@ NSString *VLCWindowShouldShowController = @"VLCWindowShouldShowController";
     NSScreen *screen = [window screen];
     NSRect screenFrame = [screen frame];
 
-    [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context) {
-        [context setDuration:0.5 * duration];
+    [NSAnimationContext runAnimationRespectingPreferencesWithDuration:0.5 * duration
+                                                              changes:^(NSAnimationContext *context) {
         [[window animator] setFrame:screenFrame display:YES];
     } completionHandler:nil];
 }
@@ -244,8 +245,8 @@ NSString *VLCWindowShouldShowController = @"VLCWindowShouldShowController";
     [window setStyleMask:([window styleMask] & ~NSWindowStyleMaskFullScreen)];
     [[window animator] setFrame:_frameBeforeLionFullscreen display:YES animate:YES];
 
-    [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context) {
-        [context setDuration:0.5 * duration];
+    [NSAnimationContext runAnimationRespectingPreferencesWithDuration:0.5 * duration
+                                                              changes:^(NSAnimationContext *context) {
         [[window animator] setFrame:self->_frameBeforeLionFullscreen display:YES animate:YES];
     } completionHandler:nil];
 }


=====================================
modules/gui/macosx/windows/video/VLCWindow.m
=====================================
@@ -23,6 +23,8 @@
 
 #import "VLCWindow.h"
 
+#import "extensions/NSAnimationContext+VLCAdditions.h"
+
 #import "main/CompatibilityFixes.h"
 #import "main/VLCMain.h"
 #import "windows/video/VLCVideoWindowCommon.h"
@@ -99,8 +101,9 @@
     // Animate window alpha value
     [self setAlphaValue:1.0];
     __weak typeof(self) this = self;
-    [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context){
-        [[NSAnimationContext currentContext] setDuration:0.9];
+
+    [NSAnimationContext runAnimationRespectingPreferencesWithDuration:0.9
+                                                              changes:^(NSAnimationContext * const __unused context) {
         [[this animator] setAlphaValue:0.0];
     } completionHandler:^{
         [this close];
@@ -119,8 +122,9 @@
         return;
     }
     __weak typeof(self) this = self;
-    [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context){
-        [[NSAnimationContext currentContext] setDuration:0.5];
+
+    [NSAnimationContext runAnimationRespectingPreferencesWithDuration:0.5
+                                                              changes:^(NSAnimationContext * const __unused context) {
         [[this animator] setAlphaValue:0.0];
     } completionHandler:^{
         [this orderOut:self];
@@ -143,10 +147,10 @@
         return;
     }
 
-    [NSAnimationContext beginGrouping];
-    [[NSAnimationContext currentContext] setDuration:0.5];
-    [[self animator] setAlphaValue:1.0];
-    [NSAnimationContext endGrouping];
+    [NSAnimationContext runAnimationRespectingPreferencesWithDuration:0.5
+                                                              changes:^(NSAnimationContext * const __unused context) {
+        [[self animator] setAlphaValue:1.0];
+    } completionHandler:nil];
 }
 
 - (BOOL)isInNativeFullscreen



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/f3b1230fc5de0934e15922f073c2dc818f2205c6...85d4a8074be8c0f26c43c55b977ef0c84db62ad6

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/f3b1230fc5de0934e15922f073c2dc818f2205c6...85d4a8074be8c0f26c43c55b977ef0c84db62ad6
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the vlc-commits mailing list