Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
df831bcc by Claudio Cambra at 2026-02-19T20:21:52+01:00
macosx: Use next responder and document-related properties for scrolling within
VLCSubScrollView
Signed-off-by: Claudio Cambra <[email protected]>
- - - - -
32dc58bd by Claudio Cambra at 2026-02-19T20:21:52+01:00
macosx: Remove use of parentScrollView on VLCSubScrollView
Signed-off-by: Claudio Cambra <[email protected]>
- - - - -
9504c30e by Claudio Cambra at 2026-02-19T20:21:52+01:00
macosx: Remove now unused stack view scroll view properties in home view
components
Signed-off-by: Claudio Cambra <[email protected]>
- - - - -
9 changed files:
- modules/gui/macosx/library/VLCLibraryCollectionViewSupplementaryDetailView.h
- modules/gui/macosx/library/VLCLibraryCollectionViewSupplementaryDetailView.m
- modules/gui/macosx/library/audio-library/VLCLibraryAudioDataSource.m
- modules/gui/macosx/library/audio-library/VLCLibraryAudioGroupDataSource.m
- modules/gui/macosx/library/home-library/VLCLibraryHomeViewController.m
-
modules/gui/macosx/library/home-library/VLCLibraryHomeViewStackViewController.h
-
modules/gui/macosx/library/home-library/VLCLibraryHomeViewStackViewController.m
- modules/gui/macosx/views/VLCSubScrollView.h
- modules/gui/macosx/views/VLCSubScrollView.m
Changes:
=====================================
modules/gui/macosx/library/VLCLibraryCollectionViewSupplementaryDetailView.h
=====================================
@@ -35,7 +35,6 @@ NS_ASSUME_NONNULL_BEGIN
@property (readwrite, retain, nonatomic) VLCLibraryRepresentedItem
*representedItem;
@property (readwrite) NSCollectionViewItem *selectedItem;
-@property (readwrite, weak) NSScrollView *parentScrollView;
@property (readwrite, assign, nonatomic) NSCollectionViewScrollDirection
layoutScrollDirection;
@property (readwrite, weak) IBOutlet NSLayoutConstraint
*contentViewTopConstraint;
=====================================
modules/gui/macosx/library/VLCLibraryCollectionViewSupplementaryDetailView.m
=====================================
@@ -135,25 +135,6 @@ static const CGFloat kBackgroundCornerRadius = 10.;
[backgroundPath stroke];
}
-- (NSScrollView *)parentScrollView
-{
- if(_internalScrollView == nil) {
- return nil;
- }
-
- return _internalScrollView.parentScrollView;
-}
-
-- (void)setParentScrollView:(NSScrollView *)parentScrollView
-{
- if(_internalScrollView == nil) {
- NSLog(@"Library collection view supplementary view has no internal
scroll view -- cannot set parent scrollview.");
- return;
- }
-
- _internalScrollView.parentScrollView = parentScrollView;
-}
-
- (BOOL)validConstraintProps
{
return _contentViewTopConstraint != nil &&
=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAudioDataSource.m
=====================================
@@ -870,7 +870,6 @@
viewForSupplementaryElementOfKind:(NSCollectionViewSupplementaryElementKind)kind
albumSupplementaryDetailView.representedItem = representedItem;
albumSupplementaryDetailView.selectedItem = [collectionView
itemAtIndex:indexPath.item];
- albumSupplementaryDetailView.parentScrollView =
VLCMain.sharedInstance.libraryWindow.audioCollectionViewScrollView;
albumSupplementaryDetailView.internalScrollView.scrollParentY = YES;
VLCLibraryCollectionViewFlowLayout *flowLayout =
(VLCLibraryCollectionViewFlowLayout*)collectionView.collectionViewLayout;
=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAudioGroupDataSource.m
=====================================
@@ -386,7 +386,6 @@
viewForSupplementaryElementOfKind:(NSCollectionViewSupplementaryElementKind)kind
albumSupplementaryDetailView.representedItem = representedItem;
albumSupplementaryDetailView.selectedItem = [collectionView
itemAtIndex:indexPath.item];
- albumSupplementaryDetailView.parentScrollView =
VLCMain.sharedInstance.libraryWindow.audioCollectionViewScrollView;
albumSupplementaryDetailView.internalScrollView.scrollParentY = YES;
return albumSupplementaryDetailView;
=====================================
modules/gui/macosx/library/home-library/VLCLibraryHomeViewController.m
=====================================
@@ -109,7 +109,6 @@
- (void)setupGridViewController
{
_stackViewController = [[VLCLibraryHomeViewStackViewController alloc]
init];
- self.stackViewController.collectionsStackViewScrollView =
_homeLibraryStackViewScrollView;
self.stackViewController.collectionsStackView = _homeLibraryStackView;
}
=====================================
modules/gui/macosx/library/home-library/VLCLibraryHomeViewStackViewController.h
=====================================
@@ -40,7 +40,6 @@ NS_ASSUME_NONNULL_BEGIN
@property (readwrite, assign, nonatomic) NSEdgeInsets
collectionViewSectionInset;
@property (readwrite, weak, nonatomic) NSStackView *collectionsStackView;
-@property (readwrite, weak, nonatomic) NSScrollView
*collectionsStackViewScrollView;
@property (readonly) VLCLibraryHomeViewActionsView *actionsView;
@property (readonly) VLCLibraryHeroView *heroView;
=====================================
modules/gui/macosx/library/home-library/VLCLibraryHomeViewStackViewController.m
=====================================
@@ -310,20 +310,6 @@
}
}
-- (void)setCollectionsStackViewScrollView:(NSScrollView *)newScrollView
-{
- NSParameterAssert(newScrollView);
-
- _collectionsStackViewScrollView = newScrollView;
-
- for (NSView<VLCLibraryHomeViewContainerView> * const containerView in
_containers) {
- if ([containerView
isKindOfClass:VLCLibraryHomeViewVideoGridContainerView.class]) {
- VLCLibraryHomeViewVideoGridContainerView * const
collectionViewContainerView = (VLCLibraryHomeViewVideoGridContainerView
*)containerView;
- collectionViewContainerView.scrollView.parentScrollView =
_collectionsStackViewScrollView;
- }
- }
-}
-
- (void)setCollectionViewItemSize:(NSSize)collectionViewItemSize
{
_collectionViewItemSize = collectionViewItemSize;
=====================================
modules/gui/macosx/views/VLCSubScrollView.h
=====================================
@@ -28,7 +28,6 @@ NS_ASSUME_NONNULL_BEGIN
@interface VLCSubScrollView : NSScrollView
-@property (readwrite, weak) NSScrollView *parentScrollView;
@property (readwrite, assign) BOOL scrollParentY;
@property (readwrite, assign) BOOL scrollParentX;
@property (readwrite, assign) BOOL scrollSelf;
=====================================
modules/gui/macosx/views/VLCSubScrollView.m
=====================================
@@ -51,30 +51,33 @@
- (void)scrollWheel:(NSEvent *)event
{
if (!_scrollSelf) {
- [_parentScrollView scrollWheel:event];
+ [self.nextResponder scrollWheel:event];
return;
}
- [super scrollWheel:event];
-
- if(_parentScrollView == nil || (!_scrollParentX && !_scrollParentY)) {
+ if (!_scrollParentX && !_scrollParentY) {
+ [super scrollWheel:event];
return;
}
- // Sometimes scroll views initialise with the Y value being almost 0, but
not quite (e.g. 0.000824)
- const BOOL isViewAtYStartAndScrollUp = self.verticalScroller.floatValue <=
0.01 && event.deltaY > 0;
- const BOOL isViewAtYEndAndScrollDown = self.verticalScroller.floatValue >=
0.99 && event.deltaY < 0;
- const BOOL isViewAtXStartAndScrollLeft =
self.horizontalScroller.floatValue <= 0.01 && event.deltaX > 0;
- const BOOL isViewAtXEndAndScrollRight = self.horizontalScroller.floatValue
>= 0.99 && event.deltaX < 0;
+ const NSRect documentVisibleRect = self.documentVisibleRect;
+ const NSRect documentFrame = self.documentView.frame;
+
+ const BOOL isViewAtYStartAndScrollUp = NSMinY(documentVisibleRect) <=
NSMinY(documentFrame) + 1.0 && event.deltaY > 0;
+ const BOOL isViewAtYEndAndScrollDown = NSMaxY(documentVisibleRect) >=
NSMaxY(documentFrame) - 1.0 && event.deltaY < 0;
+ const BOOL isViewAtXStartAndScrollLeft = NSMinX(documentVisibleRect) <=
NSMinX(documentFrame) + 1.0 && event.deltaX > 0;
+ const BOOL isViewAtXEndAndScrollRight = NSMaxX(documentVisibleRect) >=
NSMaxX(documentFrame) - 1.0 && event.deltaX < 0;
- const BOOL isSubScrollViewScrollableY =
self.documentView.frame.size.height > self.documentVisibleRect.size.height;
- const BOOL isSubScrollViewScrollableX = self.documentView.frame.size.width
> self.documentVisibleRect.size.width;
+ const BOOL isSubScrollViewScrollableY = NSHeight(documentFrame) >
NSHeight(documentVisibleRect);
+ const BOOL isSubScrollViewScrollableX = NSWidth(documentFrame) >
NSWidth(documentVisibleRect);
const BOOL shouldScrollParentY = _scrollParentY &&
(!isSubScrollViewScrollableY || isViewAtYStartAndScrollUp ||
isViewAtYEndAndScrollDown);
const BOOL shouldScrollParentX = _scrollParentX &&
(!isSubScrollViewScrollableX || isViewAtXStartAndScrollLeft ||
isViewAtXEndAndScrollRight);
- if(shouldScrollParentY || shouldScrollParentX) {
- [_parentScrollView scrollWheel:event];
+ if (shouldScrollParentY || shouldScrollParentX) {
+ [self.nextResponder scrollWheel:event];
+ } else {
+ [super scrollWheel:event];
}
}
View it on GitLab:
https://code.videolan.org/videolan/vlc/-/compare/e91e01b0352722ad21893572779118282bbbc1d7...9504c30ea9e0bee6eb1ba1a5ff56ecd6b7e4d698
--
View it on GitLab:
https://code.videolan.org/videolan/vlc/-/compare/e91e01b0352722ad21893572779118282bbbc1d7...9504c30ea9e0bee6eb1ba1a5ff56ecd6b7e4d698
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits