[vlc-commits] [Git][videolan/vlc][master] macosx: Work around unresizeable library window bug

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Sat Jul 2 05:49:15 UTC 2022



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


Commits:
42a58f2b by Claudio Cambra at 2022-07-02T05:37:50+00:00
macosx: Work around unresizeable library window bug

Signed-off-by: Claudio Cambra <claudio.cambra at gmail.com>

- - - - -


1 changed file:

- modules/gui/macosx/library/VLCLibraryWindow.m


Changes:

=====================================
modules/gui/macosx/library/VLCLibraryWindow.m
=====================================
@@ -64,6 +64,7 @@ const CGFloat VLCLibraryWindowSmallPlaylistRowHeight = 45.;
 const CGFloat VLCLibraryWindowSmallRowHeight = 24.;
 const CGFloat VLCLibraryWindowLargeRowHeight = 50.;
 const CGFloat VLCLibraryWindowDefaultPlaylistWidth = 340.;
+const CGFloat VLCLibraryWindowMinimalPlaylistWidth = 170.;
 
 static NSArray<NSLayoutConstraint *> *videoPlaceholderImageViewSizeConstraints;
 static NSArray<NSLayoutConstraint *> *audioPlaceholderImageViewSizeConstraints;
@@ -683,17 +684,23 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
     switch (dividerIndex) {
         case 0:
             return VLCLibraryWindowMinimalWidth;
+        default:
             break;
+    }
 
-        case 1:
-            return VLCLibraryWindowDefaultPlaylistWidth;
-            break;
+    return proposedMinimumPosition;
+}
 
+- (CGFloat)splitView:(NSSplitView *)splitView constrainMaxCoordinate:(CGFloat)proposedMaximumPosition ofSubviewAt:(NSInteger)dividerIndex
+{
+    switch (dividerIndex) {
+        case 0:
+            return splitView.frame.size.width - VLCLibraryWindowMinimalPlaylistWidth;
         default:
             break;
     }
 
-    return proposedMinimumPosition;
+    return proposedMaximumPosition;
 }
 
 - (BOOL)splitView:(NSSplitView *)splitView canCollapseSubview:(NSView *)subview
@@ -845,6 +852,16 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
     [window setExcludedFromWindowsMenu:YES];
     [window setAcceptsMouseMovedEvents:YES];
     [window setContentMinSize:NSMakeSize(VLCLibraryWindowMinimalWidth, VLCLibraryWindowMinimalHeight)];
+
+    // HACK: On initialisation, the window refuses to accept any border resizing. It seems the split view
+    // holds a monopoly on the edges of the window (which can be seen as the right-side of the split view
+    // lets you resize the playlist, and after doing so the window becomes resizeable.
+    
+    // This can be worked around by maximizing the window, or toggling the playlist.
+    // Toggling the playlist is simplest.
+    [window togglePlaylist];
+    [window togglePlaylist];
+
 }
 
 @end



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

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