[vlc-commits] [Git][videolan/vlc][master] 5 commits: macosx: Remove gradients and custom drawing from library bottom control bar

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Sun Mar 17 13:14:07 UTC 2024



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


Commits:
cc4a8491 by Claudio Cambra at 2024-03-17T12:56:53+00:00
macosx: Remove gradients and custom drawing from library bottom control bar

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

- - - - -
03bf5bc6 by Claudio Cambra at 2024-03-17T12:56:53+00:00
macosx: Make bottombarview material titlebar

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

- - - - -
fc8cec82 by Claudio Cambra at 2024-03-17T12:56:53+00:00
macosx: Move visual effect view into a background view of bottombarview

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

- - - - -
25461a32 by Claudio Cambra at 2024-03-17T12:56:53+00:00
macosx: Add a separator to the bottom control bar

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

- - - - -
9e296fb6 by Claudio Cambra at 2024-03-17T12:56:53+00:00
macosx: Provide better dark/light subtle border colours with full opacity

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

- - - - -


6 changed files:

- modules/gui/macosx/Resources/Assets.xcassets/VLCSubtleBorderColor.colorset/Contents.json
- modules/gui/macosx/UI/VLCLibraryWindow.xib
- modules/gui/macosx/extensions/NSColor+VLCAdditions.m
- modules/gui/macosx/views/VLCBottomBarView.h
- modules/gui/macosx/views/VLCBottomBarView.m
- modules/gui/macosx/windows/video/VLCMainVideoViewController.m


Changes:

=====================================
modules/gui/macosx/Resources/Assets.xcassets/VLCSubtleBorderColor.colorset/Contents.json
=====================================
@@ -4,10 +4,28 @@
       "color" : {
         "color-space" : "srgb",
         "components" : {
-          "alpha" : "0.200",
-          "blue" : "0.000",
-          "green" : "0.000",
-          "red" : "0.000"
+          "alpha" : "1.000",
+          "blue" : "0.900",
+          "green" : "0.900",
+          "red" : "0.900"
+        }
+      },
+      "idiom" : "universal"
+    },
+    {
+      "appearances" : [
+        {
+          "appearance" : "luminosity",
+          "value" : "light"
+        }
+      ],
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0.850",
+          "green" : "0.850",
+          "red" : "0.850"
         }
       },
       "idiom" : "universal"
@@ -22,10 +40,10 @@
       "color" : {
         "color-space" : "srgb",
         "components" : {
-          "alpha" : "0.200",
-          "blue" : "1.000",
-          "green" : "1.000",
-          "red" : "1.000"
+          "alpha" : "1.000",
+          "blue" : "0.300",
+          "green" : "0.300",
+          "red" : "0.300"
         }
       },
       "idiom" : "universal"


=====================================
modules/gui/macosx/UI/VLCLibraryWindow.xib
=====================================
@@ -355,9 +355,12 @@
                             <real value="250"/>
                         </holdingPriorities>
                     </splitView>
-                    <visualEffectView blendingMode="behindWindow" material="titlebar" state="followsWindowActiveState" translatesAutoresizingMaskIntoConstraints="NO" id="vUy-jt-gjY" customClass="VLCBottomBarView">
+                    <customView translatesAutoresizingMaskIntoConstraints="NO" id="vUy-jt-gjY" customClass="VLCBottomBarView">
                         <rect key="frame" x="0.0" y="0.0" width="896" height="48"/>
                         <subviews>
+                            <visualEffectView blendingMode="behindWindow" material="titlebar" state="followsWindowActiveState" translatesAutoresizingMaskIntoConstraints="NO" id="D5i-Pe-TAl">
+                                <rect key="frame" x="0.0" y="0.0" width="896" height="47"/>
+                            </visualEffectView>
                             <customView translatesAutoresizingMaskIntoConstraints="NO" id="MQH-bI-Zdh" customClass="VLCDragDropView">
                                 <rect key="frame" x="0.0" y="0.0" width="896" height="48"/>
                                 <subviews>
@@ -648,13 +651,17 @@
                             </customView>
                         </subviews>
                         <constraints>
+                            <constraint firstAttribute="bottom" secondItem="D5i-Pe-TAl" secondAttribute="bottom" id="1LS-Zu-gsR"/>
                             <constraint firstAttribute="height" constant="48" id="Fps-hR-AFq"/>
                             <constraint firstAttribute="bottom" secondItem="MQH-bI-Zdh" secondAttribute="bottom" id="Uo1-sD-OXk"/>
+                            <constraint firstItem="D5i-Pe-TAl" firstAttribute="leading" secondItem="vUy-jt-gjY" secondAttribute="leading" id="WKP-Ke-OrH"/>
                             <constraint firstItem="MQH-bI-Zdh" firstAttribute="leading" secondItem="vUy-jt-gjY" secondAttribute="leading" id="YVB-nY-sHE"/>
+                            <constraint firstItem="D5i-Pe-TAl" firstAttribute="top" secondItem="vUy-jt-gjY" secondAttribute="top" constant="1" id="ZD9-R0-yq0"/>
                             <constraint firstAttribute="trailing" secondItem="MQH-bI-Zdh" secondAttribute="trailing" id="aBH-H2-ykp"/>
                             <constraint firstItem="MQH-bI-Zdh" firstAttribute="top" secondItem="vUy-jt-gjY" secondAttribute="top" id="kba-GQ-94a"/>
+                            <constraint firstAttribute="trailing" secondItem="D5i-Pe-TAl" secondAttribute="trailing" id="lo1-R4-xx4"/>
                         </constraints>
-                    </visualEffectView>
+                    </customView>
                 </subviews>
                 <constraints>
                     <constraint firstAttribute="bottom" secondItem="u8g-jy-S4e" secondAttribute="bottom" priority="250" id="DQQ-ji-YSy"/>


=====================================
modules/gui/macosx/extensions/NSColor+VLCAdditions.m
=====================================
@@ -95,12 +95,12 @@
 
 + (NSColor *)VLCLightSubtleBorderColor
 {
-    return [NSColor colorWithCalibratedWhite:0 alpha:0.2];
+    return [NSColor colorWithCalibratedWhite:0 alpha:0.1];
 }
 
 + (NSColor *)VLCDarkSubtleBorderColor
 {
-    return [NSColor colorWithCalibratedWhite:1 alpha:0.2];
+    return [NSColor colorWithCalibratedWhite:1 alpha:0.3];
 }
 
 + (NSColor *)VLCSubtleBorderColor


=====================================
modules/gui/macosx/views/VLCBottomBarView.h
=====================================
@@ -22,14 +22,6 @@
 
 #import <Cocoa/Cocoa.h>
 
- at interface VLCBottomBarView : NSVisualEffectView
-
- at property NSGradient *lightGradient;
- at property NSGradient *darkGradient;
-
- at property NSColor *lightStroke;
- at property NSColor *darkStroke;
-
- at property (readwrite) BOOL isDark;
+ at interface VLCBottomBarView : NSView
 
 @end


=====================================
modules/gui/macosx/views/VLCBottomBarView.m
=====================================
@@ -23,17 +23,10 @@
 
 #import "VLCBottomBarView.h"
 
+#import "extensions/NSColor+VLCAdditions.h"
 #import "extensions/NSView+VLCAdditions.h"
 #import "extensions/NSGradient+VLCAdditions.h"
 
- at interface VLCBottomBarView () {
-    NSBezierPath *_rectanglePath;
-    NSBezierPath *_separatorPath;
-    NSRect _oldBounds;
-}
-
- at end
-
 @implementation VLCBottomBarView
 
 - (instancetype)initWithCoder:(NSCoder *)coder
@@ -71,94 +64,22 @@
 
 - (void)commonInit
 {
-    _lightGradient = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithSRGBRed:0.90 green:0.90 blue:0.90 alpha:1.0]
-                                                   endingColor:[NSColor colorWithSRGBRed:0.82 green:0.82 blue:0.82 alpha:1.0]];
-    _lightStroke = [NSColor colorWithSRGBRed:0.65 green:0.65 blue:0.65 alpha:1.0];
-
-    if (@available(macOS 10.14, *)) {
-        _darkGradient = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithSRGBRed:0.27 green:0.27 blue:0.27 alpha:1.0]
-                                                      endingColor:[NSColor colorWithSRGBRed:0.22 green:0.22 blue:0.22 alpha:1.0]];
-        _darkStroke = [NSColor colorWithSRGBRed:0.17 green:0.17 blue:0.18 alpha:1.0];
-        [self viewDidChangeEffectiveAppearance];
-    } else {
-        _darkGradient = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithSRGBRed:0.24 green:0.24 blue:0.24 alpha:1.0]
-                                                      endingColor:[NSColor colorWithSRGBRed:0.07 green:0.07 blue:0.07 alpha:1.0]];
-        _darkStroke = [NSColor blackColor];
-    }
-    
-    self.blendingMode = NSVisualEffectBlendingModeBehindWindow;
-}
-
-- (void)calculatePaths
-{
-    if (CGRectEqualToRect(_oldBounds, self.bounds))
-        return;
-
-    _oldBounds = self.bounds;
-
-    NSRect barRect = _oldBounds;
-    CGFloat rectangleCornerRadius = 4;
-
-    // Calculate bottom bar path
-    NSRect rectangleInnerRect = NSInsetRect(barRect, rectangleCornerRadius, rectangleCornerRadius);
-
-    _rectanglePath = [NSBezierPath bezierPath];
-    [_rectanglePath appendBezierPathWithArcWithCenter: NSMakePoint(NSMinX(rectangleInnerRect), NSMinY(rectangleInnerRect)) radius: rectangleCornerRadius startAngle: 180 endAngle: 270];
-    [_rectanglePath appendBezierPathWithArcWithCenter: NSMakePoint(NSMaxX(rectangleInnerRect), NSMinY(rectangleInnerRect)) radius: rectangleCornerRadius startAngle: 270 endAngle: 360];
-    [_rectanglePath lineToPoint: NSMakePoint(NSMaxX(barRect), NSMaxY(barRect))];
-    [_rectanglePath lineToPoint: NSMakePoint(NSMinX(barRect), NSMaxY(barRect))];
-    [_rectanglePath closePath];
-
-    // Calculate bottom bar separator stroke
-    _separatorPath = [NSBezierPath bezierPath];
-    [_separatorPath moveToPoint:NSMakePoint(NSMinX(barRect), NSMaxY(barRect) - 0.5)];
-    [_separatorPath lineToPoint:NSMakePoint(NSMaxX(barRect), NSMaxY(barRect) - 0.5)];
-    [_separatorPath setLineWidth:1.0];
-    [_separatorPath stroke];
+    self.wantsLayer = YES;
+    self.needsDisplay = YES;
 }
 
 - (void)drawRect:(NSRect)dirtyRect
 {
-    [self calculatePaths];
-
-    NSRect barRect = self.bounds;
+    [super drawRect:dirtyRect];
 
-    if (NSIsEmptyRect(barRect))
-        return;
+    const NSRect barFrame = self.frame;
+    NSBezierPath * const separatorPath = NSBezierPath.bezierPath;
+    [separatorPath moveToPoint:NSMakePoint(NSMinX(barFrame), NSMaxY(barFrame) - 0.5)];
+    [separatorPath lineToPoint:NSMakePoint(NSMaxX(barFrame), NSMaxY(barFrame) - 0.5)];
+    separatorPath.lineWidth = 1.0;
 
-    [[NSColor clearColor] setFill];
-    NSRectFill(barRect);
-
-    if (_isDark) {
-        [_darkGradient vlc_safeDrawInBezierPath:_rectanglePath angle:270.0];
-        [_darkStroke setStroke];
-    } else {
-        [_lightGradient vlc_safeDrawInBezierPath:_rectanglePath angle:270.0];
-        [_lightStroke setStroke];
-    }
-
-    [_separatorPath stroke];
-}
-
-- (BOOL)isFlipped
-{
-    return NO;
-}
-
-- (void)viewDidChangeEffectiveAppearance
-{
-    [super viewDidChangeEffectiveAppearance];
-
-    BOOL setDark = NO;
-
-    if (@available(macOS 10.14, *)) {
-        if ([self.effectiveAppearance.name isEqualToString:NSAppearanceNameVibrantDark]) {
-            setDark = YES;
-        }
-    }
-    
-    _isDark = setDark;
-    [self setNeedsDisplay:YES];
+    [NSColor.VLCSubtleBorderColor setStroke];
+    [separatorPath stroke];
 }
 
 @end


=====================================
modules/gui/macosx/windows/video/VLCMainVideoViewController.m
=====================================
@@ -115,7 +115,6 @@
 - (void)viewDidLoad
 {
     _autohideControls = YES;
-    _controlsBar.bottomBarView.blendingMode = NSVisualEffectBlendingModeWithinWindow;
 
     [self setDisplayLibraryControls:NO];
     [self updatePlaylistToggleState];



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/ea7ee72c7e8edbb49ef323608cbbd14c4970d980...9e296fb6f395a3f0a8afbe922705c9c4902ba58c

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