[vlc-commits] [Git][videolan/vlc][master] macosx: Unify properties used to indicate if the library window is actively...

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Fri Nov 21 20:34:17 UTC 2025



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


Commits:
f46a07c9 by Claudio Cambra at 2025-11-21T21:00:29+01:00
macosx: Unify properties used to indicate if the library window is actively presenting video playback

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

- - - - -


8 changed files:

- modules/gui/macosx/library/VLCLibraryWindow.h
- modules/gui/macosx/library/VLCLibraryWindow.m
- modules/gui/macosx/library/VLCLibraryWindowSplitViewController.m
- modules/gui/macosx/library/audio-library/VLCLibraryAudioViewController.m
- modules/gui/macosx/library/home-library/VLCLibraryHomeViewController.m
- modules/gui/macosx/library/playlist-library/VLCLibraryPlaylistViewController.m
- modules/gui/macosx/library/video-library/VLCLibraryVideoViewController.m
- modules/gui/macosx/windows/video/VLCVideoOutputProvider.m


Changes:

=====================================
modules/gui/macosx/library/VLCLibraryWindow.h
=====================================
@@ -57,6 +57,7 @@ typedef NS_ENUM(NSInteger, VLCLibraryViewModeSegment) {
 extern const CGFloat VLCLibraryWindowMinimalWidth;
 extern const CGFloat VLCLibraryWindowMinimalHeight;
 extern const NSUserInterfaceItemIdentifier VLCLibraryWindowIdentifier;
+extern NSString * const VLCLibraryWindowEmbeddedVideoPlaybackActiveKey;
 
 @property (readonly) NSView *libraryTargetView;
 
@@ -120,6 +121,7 @@ extern const NSUserInterfaceItemIdentifier VLCLibraryWindowIdentifier;
 
 @property (readwrite, nonatomic) NSInteger librarySegmentType;
 @property (readwrite) BOOL nonembedded;
+ at property (readonly) BOOL embeddedVideoPlaybackActive;
 
 @property (readwrite, weak) IBOutlet VLCLibraryWindowSplitViewController *splitViewController;
 @property (readonly) VLCLibraryAbstractSegmentViewController *librarySegmentViewController;


=====================================
modules/gui/macosx/library/VLCLibraryWindow.m
=====================================
@@ -100,6 +100,7 @@
 const CGFloat VLCLibraryWindowMinimalWidth = 604.;
 const CGFloat VLCLibraryWindowMinimalHeight = 307.;
 const NSUserInterfaceItemIdentifier VLCLibraryWindowIdentifier = @"VLCLibraryWindow";
+NSString * const VLCLibraryWindowEmbeddedVideoPlaybackActiveKey = @"embeddedVideoPlaybackActive";
 
 @interface VLCLibraryWindow () <NSControlTextEditingDelegate>
 {
@@ -402,7 +403,7 @@ static int ShowController(vlc_object_t * __unused p_this,
 
 - (IBAction)backwardsNavigationAction:(id)sender
 {
-    self.videoViewController.view.hidden
+    !self.embeddedVideoPlaybackActive
         ? [((VLCLibraryMediaSourceViewController *)self.librarySegmentViewController).navigationStack backwards]
         : [self disableVideoPlaybackAppearance];
 }
@@ -598,6 +599,10 @@ static int ShowController(vlc_object_t * __unused p_this,
 
     self.splitViewController.mainVideoModeEnabled = YES;
 
+    [self willChangeValueForKey:VLCLibraryWindowEmbeddedVideoPlaybackActiveKey];
+    _embeddedVideoPlaybackActive = YES;
+    [self didChangeValueForKey:VLCLibraryWindowEmbeddedVideoPlaybackActiveKey];
+
     if ([self.librarySegmentViewController isKindOfClass:VLCLibraryAbstractMediaLibrarySegmentViewController.class]) {
         [(VLCLibraryAbstractMediaLibrarySegmentViewController *)self.librarySegmentViewController disconnect];
     }
@@ -623,6 +628,10 @@ static int ShowController(vlc_object_t * __unused p_this,
 
     self.splitViewController.mainVideoModeEnabled = NO;
 
+    [self willChangeValueForKey:VLCLibraryWindowEmbeddedVideoPlaybackActiveKey];
+    _embeddedVideoPlaybackActive = NO;
+    [self didChangeValueForKey:VLCLibraryWindowEmbeddedVideoPlaybackActiveKey];
+
     if (self.presentLoadingOverlayOnVideoPlaybackHide) {
         [self showLoadingOverlay];
     }
@@ -680,7 +689,7 @@ static int ShowController(vlc_object_t * __unused p_this,
 
 - (void)mouseMoved:(NSEvent *)o_event
 {
-    if (!self.videoViewController.view.hidden) {
+    if (self.embeddedVideoPlaybackActive) {
         NSPoint mouseLocation = [o_event locationInWindow];
         NSView *videoView = self.videoViewController.view;
         NSRect videoViewRect = [videoView convertRect:videoView.frame toView:self.contentView];


=====================================
modules/gui/macosx/library/VLCLibraryWindowSplitViewController.m
=====================================
@@ -47,10 +47,10 @@
     [super viewDidLoad];
 
     VLCLibraryWindow * const libraryWindow = VLCMain.sharedInstance.libraryWindow;
-    [libraryWindow.videoViewController.view addObserver:self
-                                            forKeyPath:@"hidden"
-                                               options:0
-                                               context:nil];
+    [libraryWindow addObserver:self
+                    forKeyPath:VLCLibraryWindowEmbeddedVideoPlaybackActiveKey
+                       options:0
+                       context:nil];
 
     self.splitView.wantsLayer = YES;
 
@@ -107,12 +107,11 @@
                       ofObject:(id)object
                         change:(NSDictionary *)change
                        context:(void *)context
-
 {
-    if([keyPath isEqualToString:@"hidden"]) {
+    if([keyPath isEqualToString:VLCLibraryWindowEmbeddedVideoPlaybackActiveKey]) {
         VLCLibraryWindow * const libraryWindow = VLCMain.sharedInstance.libraryWindow;
-        const BOOL videoViewClosed = libraryWindow.videoViewController.view.hidden;
-        _navSidebarItem.collapsed = !videoViewClosed;
+        const BOOL videoPlaybackActive = libraryWindow.embeddedVideoPlaybackActive;
+        _navSidebarItem.collapsed = videoPlaybackActive;
     }
 }
 


=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAudioViewController.m
=====================================
@@ -539,7 +539,7 @@ NSString *VLCLibraryPlaceholderAudioViewIdentifier = @"VLCLibraryPlaceholderAudi
          self.libraryWindow.librarySegmentType == VLCLibraryGenresMusicSubSegmentType) &&
         ((audioCount == 0 && ![self.libraryTargetView.subviews containsObject:self.emptyLibraryView]) ||
          (audioCount > 0 && ![self.libraryTargetView.subviews containsObject:_audioLibraryView])) &&
-        self.libraryWindow.videoViewController.view.hidden) {
+        !self.libraryWindow.embeddedVideoPlaybackActive) {
 
         [self updatePresentedView];
     }


=====================================
modules/gui/macosx/library/home-library/VLCLibraryHomeViewController.m
=====================================
@@ -193,7 +193,7 @@
          (videoCount > 0 && !homeLibraryViewPresent) ||
          (audioCount == 0 && !emptyLibraryViewPresent) ||
          (audioCount > 0 && !homeLibraryViewPresent)) &&
-        self.libraryWindow.videoViewController.view.hidden) {
+        !self.libraryWindow.embeddedVideoPlaybackActive) {
 
         [self updatePresentedView];
     }


=====================================
modules/gui/macosx/library/playlist-library/VLCLibraryPlaylistViewController.m
=====================================
@@ -304,7 +304,7 @@
     if (self.libraryWindow.librarySegmentType == VLCLibraryPlaylistsSegmentType &&
         ((numberOfPlaylists == 0 && ![self.libraryWindow.libraryTargetView.subviews containsObject:self.libraryWindow.emptyLibraryView]) ||
          (numberOfPlaylists > 0 && ![self.libraryWindow.libraryTargetView.subviews containsObject:_collectionViewScrollView])) &&
-        self.libraryWindow.videoViewController.view.hidden) {
+        !self.libraryWindow.embeddedVideoPlaybackActive) {
 
         [self updatePresentedView];
     }
@@ -314,7 +314,7 @@
 {
     NSParameterAssert(notification);
     if (self.libraryWindow.librarySegmentType == VLCLibraryPlaylistsSegmentType &&
-        self.libraryWindow.videoViewController.view.hidden) {
+        !self.libraryWindow.embeddedVideoPlaybackActive) {
         [self updatePresentedView];
     }
 }


=====================================
modules/gui/macosx/library/video-library/VLCLibraryVideoViewController.m
=====================================
@@ -406,19 +406,19 @@
     if (self.libraryWindow.librarySegmentType == VLCLibraryVideoSegmentType &&
         ((videoCount == 0 && ![self.libraryTargetView.subviews containsObject:self.emptyLibraryView]) ||
          (videoCount > 0 && ![self.libraryTargetView.subviews containsObject:_videoLibraryView])) &&
-        self.libraryWindow.videoViewController.view.hidden) {
+        !self.libraryWindow.embeddedVideoPlaybackActive) {
 
         [self updatePresentedVideoLibraryView];
     } else if (self.libraryWindow.librarySegmentType == VLCLibraryShowsVideoSubSegmentType &&
          ((showsCount == 0 && ![self.libraryTargetView.subviews containsObject:self.emptyLibraryView]) ||
           (showsCount > 0 && ![self.libraryTargetView.subviews containsObject:_videoLibraryView])) &&
-         self.libraryWindow.videoViewController.view.hidden) {
+         !self.libraryWindow.embeddedVideoPlaybackActive) {
 
          [self updatePresentedShowsLibraryView];
      } else if (self.libraryWindow.librarySegmentType == VLCLibraryMoviesVideoSubSegmentType &&
          ((model.numberOfMovies == 0 && ![self.libraryTargetView.subviews containsObject:self.emptyLibraryView]) ||
           (model.numberOfMovies > 0 && ![self.libraryTargetView.subviews containsObject:_videoLibraryView])) &&
-         self.libraryWindow.videoViewController.view.hidden) {
+         !self.libraryWindow.embeddedVideoPlaybackActive) {
 
          [self updatePresentedMoviesLibraryView];
      }


=====================================
modules/gui/macosx/windows/video/VLCVideoOutputProvider.m
=====================================
@@ -556,7 +556,7 @@ static int WindowFloatOnTop(vlc_object_t *obj,
     }
 
     if (videoWindow.class == VLCLibraryWindow.class
-        && !videoWindow.videoViewController.view.hidden) {
+        && ((VLCLibraryWindow *)videoWindow).embeddedVideoPlaybackActive) {
         [(VLCLibraryWindow *)videoWindow disableVideoPlaybackAppearance];
     } else {
         [videoWindow close];



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/f46a07c976b5a1023eef27ba321779079fb5dfe5

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