[vlc-commits] [Git][videolan/vlc][master] 4 commits: macosx: Fix audio player controls distortion

Steve Lhomme (@robUx4) gitlab at videolan.org
Mon Nov 20 12:55:58 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
d4b13293 by Claudio Cambra at 2023-11-20T12:18:54+00:00
macosx: Fix audio player controls distortion

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
faf2dc44 by Claudio Cambra at 2023-11-20T12:18:54+00:00
macosx: Streamline transition procedure in VLCTrackingArea, deduplicate

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
e3f60015 by Claudio Cambra at 2023-11-20T12:18:54+00:00
macosx: Ensure the views to show/hide in tracking area are available prior to animation

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
d1abc78c by Claudio Cambra at 2023-11-20T12:18:54+00:00
macosx: Skip animation completion handler when mouseIn state changed in VLCTrackingArea

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -


3 changed files:

- modules/gui/macosx/UI/VLCDetachedAudioWindow.xib
- modules/gui/macosx/views/VLCTrackingView.h
- modules/gui/macosx/views/VLCTrackingView.m


Changes:

=====================================
modules/gui/macosx/UI/VLCDetachedAudioWindow.xib
=====================================
@@ -33,14 +33,14 @@
                         <subviews>
                             <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="F6N-G1-ay4" customClass="VLCCustomWindowCloseButton">
                                 <rect key="frame" x="8" y="217" width="14" height="16"/>
-                                <constraints>
-                                    <constraint firstAttribute="height" constant="16" id="h5F-zc-xQI"/>
-                                    <constraint firstAttribute="width" constant="14" id="u5l-1z-YIF"/>
-                                </constraints>
                                 <buttonCell key="cell" type="bevel" bezelStyle="rounded" image="window-close" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="WwK-DC-6gz" customClass="VLCWindowButtonCell">
                                     <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                     <font key="font" metaFont="system"/>
                                 </buttonCell>
+                                <constraints>
+                                    <constraint firstAttribute="height" constant="16" id="h5F-zc-xQI"/>
+                                    <constraint firstAttribute="width" constant="14" id="u5l-1z-YIF"/>
+                                </constraints>
                             </button>
                             <customView translatesAutoresizingMaskIntoConstraints="NO" id="5" customClass="VLCBottomBarView">
                                 <rect key="frame" x="0.0" y="0.0" width="239" height="65"/>
@@ -53,7 +53,7 @@
                                                 <subviews>
                                                     <button translatesAutoresizingMaskIntoConstraints="NO" id="11">
                                                         <rect key="frame" x="0.0" y="0.0" width="29" height="23"/>
-                                                        <buttonCell key="cell" type="bevel" bezelStyle="regularSquare" image="backward-3btns" imagePosition="only" alignment="center" alternateImage="backward-3btns-pressed" continuous="YES" enabled="NO" id="14">
+                                                        <buttonCell key="cell" type="bevel" bezelStyle="regularSquare" image="backward-3btns" imagePosition="only" alignment="center" alternateImage="backward-3btns-pressed" continuous="YES" enabled="NO" imageScaling="proportionallyUpOrDown" id="14">
                                                             <behavior key="behavior" lightByContents="YES"/>
                                                             <font key="font" metaFont="label"/>
                                                         </buttonCell>
@@ -63,9 +63,9 @@
                                                     </button>
                                                     <button translatesAutoresizingMaskIntoConstraints="NO" id="10">
                                                         <rect key="frame" x="29" y="0.0" width="27" height="23"/>
-                                                        <buttonCell key="cell" type="bevel" bezelStyle="regularSquare" image="play" imagePosition="only" alignment="center" alternateImage="play-pressed" id="15">
+                                                        <buttonCell key="cell" type="bevel" bezelStyle="regularSquare" image="play" imagePosition="only" alignment="center" alternateImage="play-pressed" imageScaling="proportionallyUpOrDown" id="15">
                                                             <behavior key="behavior" lightByContents="YES"/>
-                                                            <font key="font" metaFont="titleBar" size="12"/>
+                                                            <font key="font" metaFont="titleBar" size="12" textStyle="headline"/>
                                                         </buttonCell>
                                                         <connections>
                                                             <action selector="play:" target="3" id="39"/>
@@ -73,7 +73,7 @@
                                                     </button>
                                                     <button translatesAutoresizingMaskIntoConstraints="NO" id="12">
                                                         <rect key="frame" x="56" y="0.0" width="29" height="23"/>
-                                                        <buttonCell key="cell" type="bevel" bezelStyle="regularSquare" image="forward-3btns" imagePosition="only" alignment="center" alternateImage="forward-3btns-pressed" continuous="YES" enabled="NO" id="13">
+                                                        <buttonCell key="cell" type="bevel" bezelStyle="regularSquare" image="forward-3btns" imagePosition="only" alignment="center" alternateImage="forward-3btns-pressed" continuous="YES" enabled="NO" imageScaling="proportionallyUpOrDown" id="13">
                                                             <behavior key="behavior" lightByContents="YES"/>
                                                             <font key="font" metaFont="label"/>
                                                         </buttonCell>
@@ -97,7 +97,7 @@
                                                 </constraints>
                                             </customView>
                                             <slider hidden="YES" horizontalHuggingPriority="200" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="20" customClass="VLCSlider">
-                                                <rect key="frame" x="10" y="42" width="172" height="16"/>
+                                                <rect key="frame" x="8" y="41" width="176" height="18"/>
                                                 <constraints>
                                                     <constraint firstAttribute="height" constant="14" id="MYp-CS-yPe"/>
                                                 </constraints>
@@ -108,7 +108,7 @@
                                                     <action selector="timeSliderAction:" target="3" id="46"/>
                                                 </connections>
                                             </slider>
-                                            <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="9" customClass="VLCTimeField">
+                                            <textField focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="9" customClass="VLCTimeField">
                                                 <rect key="frame" x="185" y="44" width="46" height="13"/>
                                                 <constraints>
                                                     <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="42" id="EvZ-Sy-m25"/>


=====================================
modules/gui/macosx/views/VLCTrackingView.h
=====================================
@@ -27,8 +27,8 @@ NS_ASSUME_NONNULL_BEGIN
 @interface VLCTrackingView : NSView
 
 @property (readwrite) BOOL animatesTransition;
- at property (readwrite, assign, nullable) NSView *viewToHide;
- at property (readwrite, assign, nullable) NSView *viewToShow;
+ at property (readwrite, assign, nullable) NSView *viewToHide; // Hide when mouse out
+ at property (readwrite, assign, nullable) NSView *viewToShow; // Show when mouse out
 
 @end
 


=====================================
modules/gui/macosx/views/VLCTrackingView.m
=====================================
@@ -31,58 +31,46 @@
 
 @implementation VLCTrackingView
 
-- (void)handleMouseExit
+- (void)performTransition
 {
-    _mouseIn = NO;
-
     if (self.animatesTransition) {
-        [self.viewToHide setAlphaValue:1.0];
-        [self.viewToShow setAlphaValue:.0];
-        [self.viewToShow setHidden:NO];
+        const BOOL hideVTH = !_mouseIn;
+        const BOOL hideVTS = _mouseIn;
+        const BOOL startMouseIn = _mouseIn;
 
         __weak typeof(self.viewToHide) weakViewToHide = self.viewToHide;
         __weak typeof(self.viewToShow) weakViewToShow = self.viewToShow;
 
-        [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context){
-            [[NSAnimationContext currentContext] setDuration:0.9];
-            [[weakViewToHide animator] setAlphaValue:0.0];
-            [[weakViewToShow animator] setAlphaValue:1.0];
+        weakViewToHide.hidden = NO;
+        weakViewToShow.hidden = NO;
+
+        [NSAnimationContext runAnimationGroup:^(NSAnimationContext * const context){
+            NSAnimationContext.currentContext.duration = 0.9;
+            weakViewToHide.animator.alphaValue = hideVTH ? 0.0 : 1.0;
+            weakViewToShow.animator.alphaValue = hideVTS ? 0.0 : 1.0;
         } completionHandler:^{
-            [weakViewToHide setHidden:YES];
+            if (startMouseIn != _mouseIn) {
+                return;
+            }
+            weakViewToHide.hidden = hideVTH;
+            weakViewToShow.hidden = hideVTS;
         }];
     } else {
-        self.viewToHide.hidden = YES;
-        self.viewToShow.hidden = NO;
+        self.viewToHide.hidden = !_mouseIn;
+        self.viewToShow.hidden = _mouseIn;
     }
 }
 
 - (void)handleMouseEnter
 {
     _mouseIn = YES;
-
-    if (self.animatesTransition) {
-        [self.viewToHide setAlphaValue:.0];
-        [self.viewToHide setHidden:NO];
-
-        __weak typeof(self.viewToHide) weakViewToHide = self.viewToHide;
-        __weak typeof(self.viewToShow) weakViewToShow = self.viewToShow;
-
-        [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context){
-            [[NSAnimationContext currentContext] setDuration:0.9];
-            [[weakViewToHide animator] setAlphaValue:1.0];
-            [[weakViewToShow animator] setAlphaValue:.0];
-        } completionHandler:^{
-            [weakViewToShow setHidden:YES];
-        }];
-    } else {
-        self.viewToHide.hidden = NO;
-        self.viewToShow.hidden = YES;
-    }
+    [self performTransition];
 }
 
-- (void)mouseExited:(NSEvent *)event
+- (void)handleMouseExit
 {
-    [self handleMouseExit];
+    _mouseIn = NO;
+    [self performTransition];
 }
 
 - (void)mouseEntered:(NSEvent *)event
@@ -90,6 +78,11 @@
     [self handleMouseEnter];
 }
 
+- (void)mouseExited:(NSEvent *)event
+{
+    [self handleMouseExit];
+}
+
 - (void)updateTrackingAreas
 {
     [super updateTrackingAreas];



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/bd3c0df4b1ffb120081cebc399af83526fed647a...d1abc78cb986c0e8aca77b0ca161c11b16978012

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/bd3c0df4b1ffb120081cebc399af83526fed647a...d1abc78cb986c0e8aca77b0ca161c11b16978012
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