[vlc-commits] [Git][videolan/vlc][master] 2 commits: macosx: Stop resizing video view when starting a video and when using macOS native fullscreen

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu Nov 10 06:32:24 UTC 2022



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
48f11979 by Claudio Cambra at 2022-11-10T06:12:00+00:00
macosx: Stop resizing video view when starting a video and when using macOS native fullscreen

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

- - - - -
79052fae by Claudio Cambra at 2022-11-10T06:12:00+00:00
macosx: Stop resizing video view when stopping a video and when using macOS native fullscreen

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

- - - - -


5 changed files:

- modules/gui/macosx/library/VLCLibraryWindow.h
- modules/gui/macosx/library/VLCLibraryWindow.m
- modules/gui/macosx/windows/video/VLCVideoWindowCommon.m
- modules/gui/macosx/windows/video/VLCWindow.h
- modules/gui/macosx/windows/video/VLCWindow.m


Changes:

=====================================
modules/gui/macosx/library/VLCLibraryWindow.h
=====================================
@@ -104,7 +104,6 @@ typedef NS_ENUM(NSUInteger, VLCViewModeSegment) {
 @property (readwrite, weak) IBOutlet NSButton *forwardsNavigationButton;
 @property (readwrite, weak) IBOutlet NSButton *artworkButton;
 
- at property (readonly) BOOL nativeFullscreenMode;
 @property (readwrite) BOOL nonembedded;
 @property (readwrite) VLCLibraryNavigationStack *navigationStack;
 @property (readonly) VLCLibraryAudioDataSource *libraryAudioDataSource;


=====================================
modules/gui/macosx/library/VLCLibraryWindow.m
=====================================
@@ -843,7 +843,7 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
 
 - (void)videoPlaybackWillBeStarted
 {
-    if (!self.fullscreen)
+    if (!self.fullscreen && !self.isInNativeFullscreen)
         _windowFrameBeforePlayback = [self frame];
 }
 
@@ -916,20 +916,19 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
     // Repurpose the back button
     [self.backwardsNavigationButton setEnabled:YES];
 
-    if (self.nativeFullscreenMode) {
-        if ([self hasActiveVideo] && [self fullscreen]) {
-            [self hideControlsBar];
-            [_fspanel shouldBecomeActive:nil];
-        }
+    if (self.isInNativeFullscreen && [self hasActiveVideo] && [self fullscreen]) {
+        [self hideControlsBar];
+        [_fspanel shouldBecomeActive:nil];
     }
 }
 
 - (void)disableVideoPlaybackAppearance
 {
-    if (!self.nonembedded
-        && (!self.nativeFullscreenMode || (self.nativeFullscreenMode && !self.fullscreen))
-        && _windowFrameBeforePlayback.size.width > 0
-        && _windowFrameBeforePlayback.size.height > 0) {
+    if (!self.nonembedded &&
+        !self.isInNativeFullscreen &&
+        !self.fullscreen &&
+        _windowFrameBeforePlayback.size.width > 0 &&
+        _windowFrameBeforePlayback.size.height > 0) {
 
         // only resize back to minimum view of this is still desired final state
         CGFloat f_threshold_height = VLCVideoWindowCommonMinimalHeight + [self.controlsBar height];
@@ -961,7 +960,7 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
 
     [self setViewForSelectedSegment];
 
-    if (self.nativeFullscreenMode) {
+    if (self.isInNativeFullscreen) {
         [self showControlsBar];
         [_fspanel shouldBecomeInactive:nil];
     }


=====================================
modules/gui/macosx/windows/video/VLCVideoWindowCommon.m
=====================================
@@ -61,7 +61,7 @@ NSString *VLCWindowShouldShowController = @"VLCWindowShouldShowController";
 
     BOOL b_video_view_was_hidden;
 
-    NSRect frameBeforeLionFullscreen;
+    NSRect _frameBeforeLionFullscreen;
     VLCPlayerController *_playerController;
 }
 
@@ -358,8 +358,9 @@ NSString *VLCWindowShouldShowController = @"VLCWindowShouldShowController";
 {
     // VLC_WINDOW_SET_SIZE is triggered when exiting fullscreen. This event is ignored here
     // to avoid interference with the animation.
-    if ([self fullscreen] || _inFullscreenTransition)
+    if ([self isInNativeFullscreen] || [self fullscreen] || _inFullscreenTransition) {
         return;
+    }
 
     NSRect window_rect = [self getWindowRectForProposedVideoViewSize:self.nativeVideoSize];
     [[self animator] setFrame:window_rect display:YES];
@@ -369,8 +370,9 @@ NSString *VLCWindowShouldShowController = @"VLCWindowShouldShowController";
 {
     _nativeVideoSize = size;
 
-    if (var_InheritBool(getIntf(), "macosx-video-autoresize") && !var_InheritBool(getIntf(), "video-wallpaper"))
+    if (var_InheritBool(getIntf(), "macosx-video-autoresize") && !var_InheritBool(getIntf(), "video-wallpaper")) {
         [self resizeWindow];
+    }
 }
 
 - (NSSize)windowWillResize:(NSWindow *)window toSize:(NSSize)proposedFrameSize
@@ -379,7 +381,7 @@ NSString *VLCWindowShouldShowController = @"VLCWindowShouldShowController";
         return proposedFrameSize;
 
     // needed when entering lion fullscreen mode
-    if (_inFullscreenTransition || [self fullscreen])
+    if (_inFullscreenTransition || [self fullscreen] || [self isInNativeFullscreen])
         return proposedFrameSize;
 
     if ([_videoView isHidden])
@@ -479,11 +481,11 @@ NSString *VLCWindowShouldShowController = @"VLCWindowShouldShowController";
 - (void)window:window startCustomAnimationToExitFullScreenWithDuration:(NSTimeInterval)duration
 {
     [window setStyleMask:([window styleMask] & ~NSFullScreenWindowMask)];
-    [[window animator] setFrame:frameBeforeLionFullscreen display:YES animate:YES];
+    [[window animator] setFrame:_frameBeforeLionFullscreen display:YES animate:YES];
 
     [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context) {
         [context setDuration:0.5 * duration];
-        [[window animator] setFrame:self->frameBeforeLionFullscreen display:YES animate:YES];
+        [[window animator] setFrame:self->_frameBeforeLionFullscreen display:YES animate:YES];
     } completionHandler:nil];
 }
 
@@ -501,7 +503,7 @@ NSString *VLCWindowShouldShowController = @"VLCWindowShouldShowController";
 
     _playerController.fullscreen = YES;
 
-    frameBeforeLionFullscreen = [self frame];
+    _frameBeforeLionFullscreen = [self frame];
 
     if ([self hasActiveVideo]) {
         vout_thread_t *p_vout = [_playerController videoOutputThreadForKeyWindow];


=====================================
modules/gui/macosx/windows/video/VLCWindow.h
=====================================
@@ -38,6 +38,7 @@
 
 @property (nonatomic, readwrite) BOOL hasActiveVideo;
 @property (nonatomic, readwrite) BOOL fullscreen;
+ at property (readonly) BOOL isInNativeFullscreen;
 
 - (void)closeAndAnimate:(BOOL)animate;
 - (void)orderFront:(id)sender animate:(BOOL)animate;


=====================================
modules/gui/macosx/windows/video/VLCWindow.m
=====================================
@@ -158,4 +158,9 @@
     return nil;
 }
 
+- (BOOL)isInNativeFullscreen
+{
+    return ([self styleMask] & NSWindowStyleMaskFullScreen) == NSWindowStyleMaskFullScreen;
+}
+
 @end



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/cd262087958f9953e2f590acb9015edca02cf15d...79052fae54a5fa6ad9f03f762e066b9642ecd499

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/cd262087958f9953e2f590acb9015edca02cf15d...79052fae54a5fa6ad9f03f762e066b9642ecd499
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