[vlc-commits] [Git][videolan/vlc][master] 6 commits: macosx: Add VLCAspectRatioRetainingVideoWindow class

Steve Lhomme (@robUx4) gitlab at videolan.org
Sun Feb 5 21:11:46 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
5803428a by Claudio Cambra at 2023-02-05T20:53:32+00:00
macosx: Add VLCAspectRatioRetainingVideoWindow class

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

- - - - -
f5925689 by Claudio Cambra at 2023-02-05T20:53:32+00:00
macosx: Remove aspect ratio confining behaviour from VLCVideoWindowCommon

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

- - - - -
180f62b2 by Claudio Cambra at 2023-02-05T20:53:32+00:00
macosx: Add aspect ratio fitting code to VLCAspectRatioRetainingVideoWindow.m

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

- - - - -
be2e84da by Claudio Cambra at 2023-02-05T20:53:32+00:00
macosx: Stop resizing the library window after video playback is complete

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

- - - - -
4dd7d678 by Claudio Cambra at 2023-02-05T20:53:32+00:00
macosx: Make VLCDetachedVideoWindow a VLCAspectRatioRetainingWindow

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

- - - - -
c4a8e8a0 by Claudio Cambra at 2023-02-05T20:53:32+00:00
macosx: Fix crashing when using the library window due to bad calls to setNativeVideoSize

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

- - - - -


10 changed files:

- extras/package/macosx/VLC.xcodeproj/project.pbxproj
- modules/gui/macosx/Makefile.am
- modules/gui/macosx/library/VLCLibraryWindow.h
- modules/gui/macosx/library/VLCLibraryWindow.m
- + modules/gui/macosx/windows/video/VLCAspectRatioRetainingVideoWindow.h
- + modules/gui/macosx/windows/video/VLCAspectRatioRetainingVideoWindow.m
- modules/gui/macosx/windows/video/VLCDetachedVideoWindow.h
- modules/gui/macosx/windows/video/VLCVideoOutputProvider.m
- modules/gui/macosx/windows/video/VLCVideoWindowCommon.h
- modules/gui/macosx/windows/video/VLCVideoWindowCommon.m


Changes:

=====================================
extras/package/macosx/VLC.xcodeproj/project.pbxproj
=====================================
@@ -98,6 +98,7 @@
 		536EFBF5295BCB8300F4CB13 /* VLCLibraryUIUnits.m in Sources */ = {isa = PBXBuildFile; fileRef = 536EFBF4295BCB8300F4CB13 /* VLCLibraryUIUnits.m */; };
 		536EFC39295E521600F4CB13 /* VLCLibraryVideoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 536EFC38295E521600F4CB13 /* VLCLibraryVideoViewController.m */; };
 		53903D3A29576ED500D0B308 /* VLCLibraryAudioGroupDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 53903D3929576ED500D0B308 /* VLCLibraryAudioGroupDataSource.m */; };
+		539BA79F298C726200918C36 /* VLCAspectRatioRetainingVideoWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 539BA79E298C726200918C36 /* VLCAspectRatioRetainingVideoWindow.m */; };
 		53B447CA2939823E00857588 /* VLCLibrarySongsTableViewSongPlayingTableCellView.m in Sources */ = {isa = PBXBuildFile; fileRef = 53B447C92939823E00857588 /* VLCLibrarySongsTableViewSongPlayingTableCellView.m */; };
 		53B447F6293BB47B00857588 /* VLCLibraryVideoCollectionViewContainerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 53B447EC293BB47A00857588 /* VLCLibraryVideoCollectionViewContainerView.m */; };
 		53B447F7293BB47B00857588 /* VLCLibraryVideoCollectionViewContainerViewDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 53B447ED293BB47A00857588 /* VLCLibraryVideoCollectionViewContainerViewDataSource.m */; };
@@ -289,6 +290,8 @@
 		536EFC38295E521600F4CB13 /* VLCLibraryVideoViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCLibraryVideoViewController.m; sourceTree = "<group>"; };
 		53903D3829576ED500D0B308 /* VLCLibraryAudioGroupDataSource.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLibraryAudioGroupDataSource.h; sourceTree = "<group>"; };
 		53903D3929576ED500D0B308 /* VLCLibraryAudioGroupDataSource.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCLibraryAudioGroupDataSource.m; sourceTree = "<group>"; };
+		539BA79D298C726200918C36 /* VLCAspectRatioRetainingVideoWindow.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCAspectRatioRetainingVideoWindow.h; sourceTree = "<group>"; };
+		539BA79E298C726200918C36 /* VLCAspectRatioRetainingVideoWindow.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCAspectRatioRetainingVideoWindow.m; sourceTree = "<group>"; };
 		53B447C82939823E00857588 /* VLCLibrarySongsTableViewSongPlayingTableCellView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLibrarySongsTableViewSongPlayingTableCellView.h; sourceTree = "<group>"; };
 		53B447C92939823E00857588 /* VLCLibrarySongsTableViewSongPlayingTableCellView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCLibrarySongsTableViewSongPlayingTableCellView.m; sourceTree = "<group>"; };
 		53B447EC293BB47A00857588 /* VLCLibraryVideoCollectionViewContainerView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCLibraryVideoCollectionViewContainerView.m; sourceTree = "<group>"; };
@@ -922,6 +925,8 @@
 				CCCCDCA11413E1C000FE3DE1 /* VLCVoutView.m */,
 				7D2E0EDA20CD204D0033A221 /* VLCWindow.h */,
 				7D2E0ED920CD204D0033A221 /* VLCWindow.m */,
+				539BA79D298C726200918C36 /* VLCAspectRatioRetainingVideoWindow.h */,
+				539BA79E298C726200918C36 /* VLCAspectRatioRetainingVideoWindow.m */,
 			);
 			path = video;
 			sourceTree = "<group>";
@@ -1854,6 +1859,7 @@
 				7D2554C522C8E8B500F2D9C2 /* VLCMediaSourceDeviceCollectionViewItem.m in Sources */,
 				1CCC88F52078A3D500E5626F /* SyncTracks.xib in Sources */,
 				1CCC88F62078A3D500E5626F /* VLCInformationWindow.xib in Sources */,
+				539BA79F298C726200918C36 /* VLCAspectRatioRetainingVideoWindow.m in Sources */,
 				7D61DCE4236C1937008133CF /* VLCCustomWindowButton.m in Sources */,
 				7DFFF90123682D4800C8B0C9 /* VLCDetachedAudioWindow.m in Sources */,
 				7D66D4392200C5B80040D04A /* VLCVideoFilterHelper.m in Sources */,


=====================================
modules/gui/macosx/Makefile.am
=====================================
@@ -315,6 +315,8 @@ libmacosx_plugin_la_SOURCES = \
 	gui/macosx/windows/mainwindow/VLCControlsBarCommon.m \
 	gui/macosx/windows/mainwindow/VLCMainWindowControlsBar.h \
 	gui/macosx/windows/mainwindow/VLCMainWindowControlsBar.m \
+	gui/macosx/windows/video/VLCAspectRatioRetainingVideoWindow.h \
+	gui/macosx/windows/video/VLCAspectRatioRetainingVideoWindow.m \
 	gui/macosx/windows/video/VLCDetachedVideoWindow.h \
 	gui/macosx/windows/video/VLCDetachedVideoWindow.m \
 	gui/macosx/windows/video/VLCFSPanelController.h \


=====================================
modules/gui/macosx/library/VLCLibraryWindow.h
=====================================
@@ -136,7 +136,6 @@ extern const NSUserInterfaceItemIdentifier VLCLibraryWindowIdentifier;
 @property (readonly) VLCPlaylistController *playlistController;
 @property (readonly) VLCFSPanelController *fspanel;
 
-- (void)videoPlaybackWillBeStarted;
 - (void)reopenVideoView;
 - (void)togglePlaylist;
 


=====================================
modules/gui/macosx/library/VLCLibraryWindow.m
=====================================
@@ -74,7 +74,6 @@ const NSUserInterfaceItemIdentifier VLCLibraryWindowIdentifier = @"VLCLibraryWin
 
 @interface VLCLibraryWindow () <VLCDragDropTarget, NSSplitViewDelegate>
 {
-    NSRect _windowFrameBeforePlayback;
     CGFloat _lastPlaylistWidthBeforeCollaps;
     
     NSInteger _currentSelectedSegment;
@@ -795,12 +794,6 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
 
 #pragma mark - video output controlling
 
-- (void)videoPlaybackWillBeStarted
-{
-    if (!self.fullscreen && !self.isInNativeFullscreen)
-        _windowFrameBeforePlayback = [self frame];
-}
-
 - (void)setHasActiveVideo:(BOOL)hasActiveVideo
 {
     [super setHasActiveVideo:hasActiveVideo];
@@ -881,25 +874,6 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
 
 - (void)disableVideoPlaybackAppearance
 {
-    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];
-        if (_windowFrameBeforePlayback.size.height > f_threshold_height) {
-            if ([[VLCMain sharedInstance] isTerminating]) {
-                [self setFrame:_windowFrameBeforePlayback display:YES];
-            } else {
-                [[self animator] setFrame:_windowFrameBeforePlayback display:YES];
-            }
-        }
-    }
-
-    _windowFrameBeforePlayback = NSMakeRect(0, 0, 0, 0);
-
     [self makeFirstResponder: _playlistTableView];
     [[[VLCMain sharedInstance] voutProvider] updateWindowLevelForHelperWindows: NSNormalWindowLevel];
 


=====================================
modules/gui/macosx/windows/video/VLCAspectRatioRetainingVideoWindow.h
=====================================
@@ -0,0 +1,33 @@
+/*****************************************************************************
+ * VLCAspectRatioRetainingVideoWindow.h: MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2023 VLC authors and VideoLAN
+ *
+ * Authors: Claudio Cambra <developer at claudiocambra.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#import "VLCVideoWindowCommon.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+ at interface VLCAspectRatioRetainingVideoWindow : VLCVideoWindowCommon
+
+ at property (nonatomic, readwrite, assign) NSSize nativeVideoSize;
+
+ at end
+
+NS_ASSUME_NONNULL_END


=====================================
modules/gui/macosx/windows/video/VLCAspectRatioRetainingVideoWindow.m
=====================================
@@ -0,0 +1,122 @@
+/*****************************************************************************
+ * VLCAspectRatioRetainingVideoWindow.m: MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2023 VLC authors and VideoLAN
+ *
+ * Authors: Claudio Cambra <developer at claudiocambra.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#import "VLCAspectRatioRetainingVideoWindow.h"
+
+#import "main/VLCMain.h"
+#import "playlist/VLCPlayerController.h"
+#import "windows/video/VLCVoutView.h"
+
+ at implementation VLCAspectRatioRetainingVideoWindow
+
+#pragma mark -
+#pragma mark Video window resizing logic
+
+- (NSRect)getWindowRectForProposedVideoViewSize:(NSSize)size
+{
+    NSSize windowMinSize = [self minSize];
+    NSRect screenFrame = [[self screen] visibleFrame];
+
+    NSRect topleftbase = NSMakeRect(0, [self frame].size.height, 0, 0);
+    NSPoint topleftscreen = [self convertRectToScreen: topleftbase].origin;
+
+    CGFloat f_width = size.width;
+    CGFloat f_height = size.height;
+    if (f_width < windowMinSize.width)
+        f_width = windowMinSize.width;
+    if (f_height < VLCVideoWindowCommonMinimalHeight)
+        f_height = VLCVideoWindowCommonMinimalHeight;
+
+    /* Calculate the window's new size */
+    NSRect new_frame;
+    new_frame.size.width = [self frame].size.width - [self.videoView frame].size.width + f_width;
+    new_frame.size.height = [self frame].size.height - [self.videoView frame].size.height + f_height;
+    new_frame.origin.x = topleftscreen.x;
+    new_frame.origin.y = topleftscreen.y - new_frame.size.height;
+
+    /* make sure the window doesn't exceed the screen size the window is on */
+    if (new_frame.size.width > screenFrame.size.width) {
+        new_frame.size.width = screenFrame.size.width;
+        new_frame.origin.x = screenFrame.origin.x;
+    }
+    if (new_frame.size.height > screenFrame.size.height) {
+        new_frame.size.height = screenFrame.size.height;
+        new_frame.origin.y = screenFrame.origin.y;
+    }
+    if (new_frame.origin.y < screenFrame.origin.y)
+        new_frame.origin.y = screenFrame.origin.y;
+
+    CGFloat right_screen_point = screenFrame.origin.x + screenFrame.size.width;
+    CGFloat right_window_point = new_frame.origin.x + new_frame.size.width;
+    if (right_window_point > right_screen_point)
+        new_frame.origin.x -= (right_window_point - right_screen_point);
+
+    return new_frame;
+}
+
+- (void)resizeWindow
+{
+    // VLC_WINDOW_SET_SIZE is triggered when exiting fullscreen. This event is ignored here
+    // to avoid interference with the animation.
+    if ([self isInNativeFullscreen] || [self fullscreen] || self.inFullscreenTransition) {
+        return;
+    }
+
+    NSRect window_rect = [self getWindowRectForProposedVideoViewSize:self.nativeVideoSize];
+    [[self animator] setFrame:window_rect display:YES];
+}
+
+- (void)setNativeVideoSize:(NSSize)size
+{
+    _nativeVideoSize = size;
+
+    if (var_InheritBool(getIntf(), "macosx-video-autoresize") && !var_InheritBool(getIntf(), "video-wallpaper")) {
+        [self resizeWindow];
+    }
+}
+
+- (NSSize)windowWillResize:(NSWindow *)window toSize:(NSSize)proposedFrameSize
+{
+    if (![self.playerController activeVideoPlayback] || self.nativeVideoSize.width == 0. || self.nativeVideoSize.height == 0. || window != self)
+        return proposedFrameSize;
+
+    // needed when entering lion fullscreen mode
+    if (self.inFullscreenTransition || [self fullscreen] || [self isInNativeFullscreen])
+        return proposedFrameSize;
+
+    if ([self.videoView isHidden])
+        return proposedFrameSize;
+
+    if ([self.playerController aspectRatioIsLocked]) {
+        NSRect videoWindowFrame = [self frame];
+        NSRect viewRect = [self.videoView convertRect:[self.videoView bounds] toView: nil];
+        NSRect contentRect = [self contentRectForFrameRect:videoWindowFrame];
+        CGFloat marginy = viewRect.origin.y + videoWindowFrame.size.height - contentRect.size.height;
+        CGFloat marginx = contentRect.size.width - viewRect.size.width;
+
+        proposedFrameSize.height = (proposedFrameSize.width - marginx) * self.nativeVideoSize.height / self.nativeVideoSize.width + marginy;
+    }
+
+    return proposedFrameSize;
+}
+
+ at end


=====================================
modules/gui/macosx/windows/video/VLCDetachedVideoWindow.h
=====================================
@@ -21,8 +21,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#import "VLCVideoWindowCommon.h"
+#import "VLCAspectRatioRetainingVideoWindow.h"
 
- at interface VLCDetachedVideoWindow : VLCVideoWindowCommon
+ at interface VLCDetachedVideoWindow : VLCAspectRatioRetainingVideoWindow
 
 @end


=====================================
modules/gui/macosx/windows/video/VLCVideoOutputProvider.m
=====================================
@@ -23,17 +23,13 @@
 
 #import "VLCVideoOutputProvider.h"
 
-#include <vlc_vout_display.h>
-
 #import "extensions/NSScreen+VLCAdditions.h"
 
+#import "library/VLCLibraryWindow.h"
+
 #import "main/CompatibilityFixes.h"
 #import "main/VLCMain.h"
-#import "windows/video/VLCDetachedVideoWindow.h"
-#import "windows/video/VLCVoutView.h"
-#import "playlist/VLCPlaylistController.h"
-#import "playlist/VLCPlayerController.h"
-#import "library/VLCLibraryWindow.h"
+
 #import "os-integration/VLCKeyboardBacklightControl.h"
 
 #import "panels/VLCVideoEffectsWindowController.h"
@@ -41,6 +37,15 @@
 #import "panels/VLCBookmarksWindowController.h"
 #import "panels/VLCTrackSynchronizationWindowController.h"
 
+#import "playlist/VLCPlaylistController.h"
+#import "playlist/VLCPlayerController.h"
+
+#import "windows/video/VLCAspectRatioRetainingVideoWindow.h"
+#import "windows/video/VLCDetachedVideoWindow.h"
+#import "windows/video/VLCVoutView.h"
+
+#include <vlc_vout_display.h>
+
 NSString *VLCWindowShouldUpdateLevel = @"VLCWindowShouldUpdateLevel";
 NSString *VLCWindowLevelKey = @"VLCWindowLevelKey";
 
@@ -266,11 +271,7 @@ int WindowOpen(vlc_window_t *p_wnd)
 - (VLCVideoWindowCommon *)setupMainLibraryVideoWindow
 {
     VLCMain *mainInstance = [VLCMain sharedInstance];
-    
-    // should be called before any window resizing occurs
-    [mainInstance.libraryWindow videoPlaybackWillBeStarted];
     b_mainWindowHasVideo = YES;
-    
     return mainInstance.libraryWindow;
 }
 
@@ -347,6 +348,10 @@ int WindowOpen(vlc_window_t *p_wnd)
     if (!isEmbedded) {
         [self setupWindowOriginForVideoWindow:videoWindow
                                    atPosition:videoViewPosition];
+
+        if ([videoWindow isKindOfClass:[VLCAspectRatioRetainingVideoWindow class]]) {
+            [(VLCAspectRatioRetainingVideoWindow*)videoWindow setNativeVideoSize:videoViewSize];
+        }
     }
 
     // cascade windows if we have more than one vout
@@ -354,8 +359,6 @@ int WindowOpen(vlc_window_t *p_wnd)
         [self cascadeVoutWindowsForVideoWindow:videoWindow];
     }
 
-    // resize window
-    [videoWindow setNativeVideoSize:videoViewSize];
     [videoWindow makeKeyAndOrderFront: self];
 }
 
@@ -473,9 +476,11 @@ int WindowOpen(vlc_window_t *p_wnd)
     if (!o_window) {
         msg_Err(getIntf(), "Cannot set size for nonexisting window");
         return;
+    } else if (![o_window isKindOfClass:[VLCAspectRatioRetainingVideoWindow class]]) {
+        return;
     }
 
-    [o_window setNativeVideoSize:size];
+    [(VLCAspectRatioRetainingVideoWindow*)o_window setNativeVideoSize:size];
 }
 
 - (void)setWindowLevel:(NSInteger)i_level forWindow:(vlc_window_t *)p_wnd


=====================================
modules/gui/macosx/windows/video/VLCVideoWindowCommon.h
=====================================
@@ -32,6 +32,7 @@ extern const CGFloat VLCVideoWindowCommonMinimalHeight;
 
 @class VLCVoutView;
 @class VLCControlsBarCommon;
+ at class VLCPlayerController;
 
 /*****************************************************************************
  * VLCVideoWindowCommon
@@ -48,12 +49,9 @@ extern const CGFloat VLCVideoWindowCommonMinimalHeight;
 @property (readonly) BOOL inFullscreenTransition;
 @property (readonly) BOOL windowShouldExitFullscreenWhenFinished;
 @property (readwrite, assign) NSRect previousSavedFrame;
- at property (nonatomic, readwrite, assign) NSSize nativeVideoSize;
+ at property (readonly) VLCPlayerController *playerController;
 
 - (void)setWindowLevel:(NSInteger)i_state;
-- (void)resizeWindow;
-
-- (NSRect)getWindowRectForProposedVideoViewSize:(NSSize)size;
 
 /* fullscreen handling */
 - (void)enterFullscreenWithAnimation:(BOOL)b_animation;


=====================================
modules/gui/macosx/windows/video/VLCVideoWindowCommon.m
=====================================
@@ -62,7 +62,6 @@ NSString *VLCWindowShouldShowController = @"VLCWindowShouldShowController";
     BOOL b_video_view_was_hidden;
 
     NSRect _frameBeforeLionFullscreen;
-    VLCPlayerController *_playerController;
 }
 
 - (void)customZoom:(id)sender;
@@ -297,8 +296,8 @@ NSString *VLCWindowShouldShowController = @"VLCWindowShouldShowController";
     [self setFrame: maxRect display: YES animate: YES];
 }
 
-#pragma mark -
-#pragma mark Video window resizing logic
+# pragma mark -
+# pragma mark Window level handling
 
 - (void)setWindowLevel:(NSInteger)i_state
 {
@@ -312,94 +311,6 @@ NSString *VLCWindowShouldShowController = @"VLCWindowShouldShowController";
     i_originalLevel = i_state;
 }
 
-- (NSRect)getWindowRectForProposedVideoViewSize:(NSSize)size
-{
-    NSSize windowMinSize = [self minSize];
-    NSRect screenFrame = [[self screen] visibleFrame];
-
-    NSRect topleftbase = NSMakeRect(0, [self frame].size.height, 0, 0);
-    NSPoint topleftscreen = [self convertRectToScreen: topleftbase].origin;
-
-    CGFloat f_width = size.width;
-    CGFloat f_height = size.height;
-    if (f_width < windowMinSize.width)
-        f_width = windowMinSize.width;
-    if (f_height < VLCVideoWindowCommonMinimalHeight)
-        f_height = VLCVideoWindowCommonMinimalHeight;
-
-    /* Calculate the window's new size */
-    NSRect new_frame;
-    new_frame.size.width = [self frame].size.width - [_videoView frame].size.width + f_width;
-    new_frame.size.height = [self frame].size.height - [_videoView frame].size.height + f_height;
-    new_frame.origin.x = topleftscreen.x;
-    new_frame.origin.y = topleftscreen.y - new_frame.size.height;
-
-    /* make sure the window doesn't exceed the screen size the window is on */
-    if (new_frame.size.width > screenFrame.size.width) {
-        new_frame.size.width = screenFrame.size.width;
-        new_frame.origin.x = screenFrame.origin.x;
-    }
-    if (new_frame.size.height > screenFrame.size.height) {
-        new_frame.size.height = screenFrame.size.height;
-        new_frame.origin.y = screenFrame.origin.y;
-    }
-    if (new_frame.origin.y < screenFrame.origin.y)
-        new_frame.origin.y = screenFrame.origin.y;
-
-    CGFloat right_screen_point = screenFrame.origin.x + screenFrame.size.width;
-    CGFloat right_window_point = new_frame.origin.x + new_frame.size.width;
-    if (right_window_point > right_screen_point)
-        new_frame.origin.x -= (right_window_point - right_screen_point);
-
-    return new_frame;
-}
-
-- (void)resizeWindow
-{
-    // VLC_WINDOW_SET_SIZE is triggered when exiting fullscreen. This event is ignored here
-    // to avoid interference with the animation.
-    if ([self isInNativeFullscreen] || [self fullscreen] || _inFullscreenTransition) {
-        return;
-    }
-
-    NSRect window_rect = [self getWindowRectForProposedVideoViewSize:self.nativeVideoSize];
-    [[self animator] setFrame:window_rect display:YES];
-}
-
-- (void)setNativeVideoSize:(NSSize)size
-{
-    _nativeVideoSize = size;
-
-    if (var_InheritBool(getIntf(), "macosx-video-autoresize") && !var_InheritBool(getIntf(), "video-wallpaper")) {
-        [self resizeWindow];
-    }
-}
-
-- (NSSize)windowWillResize:(NSWindow *)window toSize:(NSSize)proposedFrameSize
-{
-    if (![_playerController activeVideoPlayback] || self.nativeVideoSize.width == 0. || self.nativeVideoSize.height == 0. || window != self)
-        return proposedFrameSize;
-
-    // needed when entering lion fullscreen mode
-    if (_inFullscreenTransition || [self fullscreen] || [self isInNativeFullscreen])
-        return proposedFrameSize;
-
-    if ([_videoView isHidden])
-        return proposedFrameSize;
-
-    if ([_playerController aspectRatioIsLocked]) {
-        NSRect videoWindowFrame = [self frame];
-        NSRect viewRect = [_videoView convertRect:[_videoView bounds] toView: nil];
-        NSRect contentRect = [self contentRectForFrameRect:videoWindowFrame];
-        CGFloat marginy = viewRect.origin.y + videoWindowFrame.size.height - contentRect.size.height;
-        CGFloat marginx = contentRect.size.width - viewRect.size.width;
-
-        proposedFrameSize.height = (proposedFrameSize.width - marginx) * self.nativeVideoSize.height / self.nativeVideoSize.width + marginy;
-    }
-
-    return proposedFrameSize;
-}
-
 - (void)windowWillMiniaturize:(NSNotification *)notification
 {
     // Set level to normal as a workaround for Mavericks bug causing window



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/37d78c972aa6b7c186a484ec8f4a3bc5aecc3bae...c4a8e8a05423b6f15f848102f7e3e628cce99a20

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/37d78c972aa6b7c186a484ec8f4a3bc5aecc3bae...c4a8e8a05423b6f15f848102f7e3e628cce99a20
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