[vlc-commits] [Git][videolan/vlc][master] 5 commits: macosx: Fix alignment of glass header background view in VLCLibraryAudioGroupTableHeaderView
Steve Lhomme (@robUx4)
gitlab at videolan.org
Sun Dec 14 16:27:56 UTC 2025
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
8a425e42 by Claudio Cambra at 2025-12-14T16:05:54+00:00
macosx: Fix alignment of glass header background view in VLCLibraryAudioGroupTableHeaderView
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
88db03eb by Claudio Cambra at 2025-12-14T16:05:54+00:00
macosx: Fix and simplify the configuration of the non-glass effect views in the audio group table header view
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
977e485d by Claudio Cambra at 2025-12-14T16:05:54+00:00
macosx: Simplify constraint constants in audio group table header view
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
6c396d59 by Claudio Cambra at 2025-12-14T16:05:54+00:00
macosx: Fix border colour updating for header view on light/dark switch
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
71b8cdb6 by Claudio Cambra at 2025-12-14T16:05:54+00:00
macosx: Remove unneeded clipsToBounds in setupAudioTableViews
THe value of this property defaults to NO on on macOS 14 and later
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
2 changed files:
- modules/gui/macosx/library/audio-library/VLCLibraryAudioGroupTableHeaderView.m
- modules/gui/macosx/library/audio-library/VLCLibraryAudioViewController.m
Changes:
=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAudioGroupTableHeaderView.m
=====================================
@@ -41,7 +41,6 @@ const CGFloat VLCLibraryAudioGroupTableHeaderViewHeight = 86.f;
@property NSTextField *detailField;
@property NSButton *playButton;
@property NSButton *queueButton;
- at property CGFloat backgroundEdgeInset;
@end
@@ -69,7 +68,8 @@ const CGFloat VLCLibraryAudioGroupTableHeaderViewHeight = 86.f;
- (void)commonInit
{
NSView *contentHostView = self;
- self.backgroundEdgeInset = 0.f;
+ const CGFloat backgroundTopInset = VLCLibraryUIUnits.largeSpacing + VLCLibraryUIUnits.mediumSpacing;
+ CGFloat backgroundBottomInset = 0.f;
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 260000
if (@available(macOS 26.0, *)) {
@@ -80,27 +80,24 @@ const CGFloat VLCLibraryAudioGroupTableHeaderViewHeight = 86.f;
glassView.contentView = glassContentView;
self.backgroundView = glassView;
contentHostView = glassContentView;
- self.backgroundEdgeInset = VLCLibraryUIUnits.largeSpacing * 1.75;
- }
+ backgroundBottomInset = VLCLibraryUIUnits.largeSpacing + VLCLibraryUIUnits.mediumSpacing + VLCLibraryUIUnits.smallSpacing;
+ } else
#endif
- if (self.backgroundView == nil) {
- self.wantsLayer = YES;
-
- if (@available(macOS 10.14, *)) {
- NSVisualEffectView * const visualEffectView = [[NSVisualEffectView alloc] initWithFrame:self.bounds];
- visualEffectView.translatesAutoresizingMaskIntoConstraints = NO;
- visualEffectView.material = NSVisualEffectMaterialHeaderView;
- visualEffectView.blendingMode = NSVisualEffectBlendingModeWithinWindow;
- visualEffectView.state = NSVisualEffectStateFollowsWindowActiveState;
- self.backgroundView = visualEffectView;
- }
- }
- if (self.backgroundView == nil) {
+ if (@available(macOS 10.14, *)) {
+ NSVisualEffectView * const visualEffectView = [[NSVisualEffectView alloc] initWithFrame:self.bounds];
+ visualEffectView.translatesAutoresizingMaskIntoConstraints = NO;
+ visualEffectView.wantsLayer = YES;
+ visualEffectView.material = NSVisualEffectMaterialPopover;
+ visualEffectView.blendingMode = NSVisualEffectBlendingModeWithinWindow;
+ self.backgroundView = visualEffectView;
+ contentHostView = visualEffectView;
+ } else {
NSView * const fallbackBackgroundView = [[NSView alloc] initWithFrame:self.bounds];
fallbackBackgroundView.translatesAutoresizingMaskIntoConstraints = NO;
fallbackBackgroundView.wantsLayer = YES;
fallbackBackgroundView.layer.backgroundColor = NSColor.windowBackgroundColor.CGColor;
self.backgroundView = fallbackBackgroundView;
+ contentHostView = fallbackBackgroundView;
}
[self addSubview:self.backgroundView];
@@ -135,15 +132,13 @@ const CGFloat VLCLibraryAudioGroupTableHeaderViewHeight = 86.f;
[contentHostView addSubview:labelsStack];
[contentHostView addSubview:buttonsStack];
- const CGFloat backgroundInset = self.backgroundEdgeInset;
const CGFloat horizontalContentInset = VLCLibraryUIUnits.mediumSpacing;
- const CGFloat verticalContentInset = VLCLibraryUIUnits.smallSpacing;
[NSLayoutConstraint activateConstraints:@[
- [self.backgroundView.topAnchor constraintEqualToAnchor:self.topAnchor constant:backgroundInset * 0.66],
+ [self.backgroundView.topAnchor constraintEqualToAnchor:self.topAnchor constant:backgroundTopInset],
[self.backgroundView.leadingAnchor constraintEqualToAnchor:self.leadingAnchor],
[self.backgroundView.trailingAnchor constraintEqualToAnchor:self.trailingAnchor],
- [self.backgroundView.bottomAnchor constraintEqualToAnchor:self.bottomAnchor constant:-backgroundInset],
+ [self.backgroundView.bottomAnchor constraintEqualToAnchor:self.bottomAnchor constant:-backgroundBottomInset],
[labelsStack.leadingAnchor constraintEqualToAnchor:contentHostView.leadingAnchor constant:horizontalContentInset],
[labelsStack.centerYAnchor constraintEqualToAnchor:contentHostView.centerYAnchor],
[contentHostView.trailingAnchor constraintEqualToAnchor:buttonsStack.trailingAnchor constant:horizontalContentInset],
@@ -153,10 +148,35 @@ const CGFloat VLCLibraryAudioGroupTableHeaderViewHeight = 86.f;
if (@available(macOS 26.0, *)) {
} else {
- self.layer.cornerRadius = VLCLibraryUIUnits.smallSpacing;
- self.layer.masksToBounds = YES;
- self.layer.borderWidth = VLCLibraryUIUnits.borderThickness;
- [self updateAppearance];
+ self.backgroundView.layer.borderColor = NSColor.VLCSubtleBorderColor.CGColor;
+ self.backgroundView.layer.borderWidth = VLCLibraryUIUnits.borderThickness;
+ self.backgroundView.layer.cornerRadius = VLCLibraryUIUnits.cornerRadius;
+ self.backgroundView.layer.masksToBounds = YES;
+
+ if (@available(macOS 10.14, *)) {
+ [NSApplication.sharedApplication addObserver:self
+ forKeyPath:@"effectiveAppearance"
+ options:NSKeyValueObservingOptionNew
+ context:nil];
+ }
+ }
+}
+
+- (void)observeValueForKeyPath:(NSString *)keyPath
+ ofObject:(id)object
+ change:(NSDictionary<NSKeyValueChangeKey,id> *)change
+ context:(void *)context
+{
+ if (@available(macOS 26.0, *)) {
+ return;
+ } else if ([keyPath isEqualToString:@"effectiveAppearance"]) {
+ if (@available(macOS 10.14, *)) {
+ NSAppearance * const appearance = change[NSKeyValueChangeNewKey];
+ const BOOL isDark = [appearance.name isEqualToString:NSAppearanceNameDarkAqua] ||
+ [appearance.name isEqualToString:NSAppearanceNameVibrantDark];
+ self.backgroundView.layer.borderColor = isDark ?
+ NSColor.VLCDarkSubtleBorderColor.CGColor : NSColor.VLCLightSubtleBorderColor.CGColor;
+ }
}
}
@@ -198,30 +218,6 @@ const CGFloat VLCLibraryAudioGroupTableHeaderViewHeight = 86.f;
return button;
}
-- (void)updateAppearance
-{
- if (@available(macOS 26.0, *))
- return;
-
- if (@available(macOS 10.14, *)) {
- NSAppearance *appearance = self.effectiveAppearance;
- BOOL isDark = NO;
- if ([appearance.name isEqualToString:NSAppearanceNameDarkAqua] ||
- [appearance.name isEqualToString:NSAppearanceNameVibrantDark]) {
- isDark = YES;
- }
- self.layer.borderColor = (isDark ? NSColor.VLCDarkSubtleBorderColor : NSColor.VLCLightSubtleBorderColor).CGColor;
- } else {
- self.layer.borderColor = NSColor.VLCLightSubtleBorderColor.CGColor;
- }
-}
-
-- (void)viewDidChangeEffectiveAppearance
-{
- [super viewDidChangeEffectiveAppearance];
- [self updateAppearance];
-}
-
- (void)setRepresentedItem:(VLCLibraryRepresentedItem *)representedItem
{
_representedItem = representedItem;
=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAudioViewController.m
=====================================
@@ -190,7 +190,7 @@ NSString *VLCLibraryPlaceholderAudioViewIdentifier = @"VLCLibraryPlaceholderAudi
CGFloat headerHeight = VLCLibraryAudioGroupTableHeaderViewHeight;
if (@available(macOS 26.0, *)) {
- headerHeight += VLCLibraryUIUnits.largeSpacing * 2.f;
+ headerHeight += VLCLibraryUIUnits.largeSpacing * 2;
}
const NSRect headerFrame = NSMakeRect(0.f,
@@ -288,7 +288,9 @@ NSString *VLCLibraryPlaceholderAudioViewIdentifier = @"VLCLibraryPlaceholderAudi
_audioCollectionSelectionTableViewScrollView.contentInsets = audioScrollViewContentInsets;
_audioCollectionSelectionTableViewScrollView.scrollerInsets = audioScrollViewScrollerInsets;
_audioGroupSelectionTableViewScrollView.automaticallyAdjustsContentInsets = NO;
- _audioGroupSelectionTableViewScrollView.contentInsets = audioScrollViewContentInsets;
+ NSEdgeInsets adjustedInsets = audioScrollViewContentInsets;
+ adjustedInsets.top -= VLCLibraryUIUnits.largeSpacing;
+ _audioGroupSelectionTableViewScrollView.contentInsets = adjustedInsets;
_audioGroupSelectionTableViewScrollView.scrollerInsets = audioScrollViewScrollerInsets;
_audioLibraryGridModeSplitViewListTableViewScrollView.automaticallyAdjustsContentInsets = NO;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/29796183b1b814583272459d0d900dc2dad413e9...71b8cdb605c402167abf834ad88595ffa19c1b64
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/29796183b1b814583272459d0d900dc2dad413e9...71b8cdb605c402167abf834ad88595ffa19c1b64
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