[vlc-commits] [Git][videolan/vlc][master] 2 commits: macosx: Add public method to commit current value

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Aug 7 01:23:04 UTC 2026



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
322d5413 by Claudio Cambra at 2026-08-07T01:07:25+00:00
macosx: Add public method to commit current value

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

- - - - -
a0dce839 by Claudio Cambra at 2026-08-07T01:07:25+00:00
macosx: Fix updating of original value when clicking rating indicator in supplementary detail view

mouseUp is never called in the rating indicator

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

- - - - -


3 changed files:

- modules/gui/macosx/library/VLCLibraryCollectionViewMediaItemSupplementaryDetailView.m
- modules/gui/macosx/views/VLCLibraryRatingIndicator.h
- modules/gui/macosx/views/VLCLibraryRatingIndicator.m


Changes:

=====================================
modules/gui/macosx/library/VLCLibraryCollectionViewMediaItemSupplementaryDetailView.m
=====================================
@@ -39,6 +39,7 @@
 #import "library/VLCLibraryWindow.h"
 
 #import "views/VLCImageView.h"
+#import "views/VLCLibraryRatingIndicator.h"
 
 NSString *const VLCLibraryCollectionViewMediaItemSupplementaryDetailViewIdentifier = @"VLCLibraryCollectionViewMediaItemSupplementaryDetailViewIdentifier";
 NSCollectionViewSupplementaryElementKind const VLCLibraryCollectionViewMediaItemSupplementaryDetailViewKind = @"VLCLibraryCollectionViewMediaItemSupplementaryDetailViewIdentifier";
@@ -254,14 +255,14 @@ NSCollectionViewSupplementaryElementKind const VLCLibraryCollectionViewMediaItem
 
 - (IBAction)ratingAction:(id)sender
 {
-    NSLevelIndicator * const control = (NSLevelIndicator *)sender;
-    if (control == nil) {
-        return;
-    }
-
+    NSParameterAssert([sender isKindOfClass:VLCLibraryRatingIndicator.class]);
+    VLCLibraryRatingIndicator * const control = sender;
     const double proportion = 100 / control.maxValue;
     const double rating = control.doubleValue * proportion;
     ((VLCMediaLibraryMediaItem *)self.representedItem.item).rating = (int)rating;
+
+    // NSLevelIndicatorCell handles mouse-up during tracking, so the view's mouseUp: is not called.
+    [control commitCurrentValue];
 }
 
 - (IBAction)openPathAction:(id)sender


=====================================
modules/gui/macosx/views/VLCLibraryRatingIndicator.h
=====================================
@@ -30,6 +30,8 @@ NS_ASSUME_NONNULL_BEGIN
 @property (nonatomic) CGFloat         originalValue;
 @property (nonatomic) NSTrackingArea *trackingArea;
 
+- (void)commitCurrentValue;
+
 @end
 
 NS_ASSUME_NONNULL_END


=====================================
modules/gui/macosx/views/VLCLibraryRatingIndicator.m
=====================================
@@ -67,13 +67,9 @@
     }
 }
 
-- (void)mouseUp:(NSEvent *)event
+- (void)commitCurrentValue
 {
-    [super mouseUp:event];
-
-    if (self.isHovering) {
-        self.originalValue = self.doubleValue;
-    }
+    self.originalValue = self.doubleValue;
 }
 
 - (void)setDoubleValue:(double)doubleValue



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/440c42452d79bc5acad7ba33e9e5fedfbbed4c7d...a0dce8399884e391b8664cd54f07544dcb39bdb9

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