diff --git a/modules/gui/macosx/library/VLCLibraryWindow.m b/modules/gui/macosx/library/VLCLibraryWindow.m index 7f9e9768f6..7a4558303f 100644 --- a/modules/gui/macosx/library/VLCLibraryWindow.m +++ b/modules/gui/macosx/library/VLCLibraryWindow.m @@ -130,6 +130,7 @@ static void addShadow(NSImageView *__unsafe_unretained imageView) - (void)awakeFromNib { + [super awakeFromNib]; self.identifier = VLCLibraryWindowIdentifier; if(@available(macOS 10.12, *)) { @@ -148,7 +149,6 @@ static void addShadow(NSImageView *__unsafe_unretained imageView) self.navigationStack = [[VLCLibraryNavigationStack alloc] init]; self.navigationStack.delegate = self; - self.videoViewController = [[VLCMainVideoViewController alloc] init]; self.videoViewController.view.frame = self.mainSplitView.frame; self.videoViewController.view.hidden = YES; self.videoViewController.displayLibraryControls = YES; diff --git a/modules/gui/macosx/windows/video/VLCVideoOutputProvider.m b/modules/gui/macosx/windows/video/VLCVideoOutputProvider.m index e78ec98683..11c2e2ddd3 100644 --- a/modules/gui/macosx/windows/video/VLCVideoOutputProvider.m +++ b/modules/gui/macosx/windows/video/VLCVideoOutputProvider.m @@ -281,9 +281,30 @@ int WindowOpen(vlc_window_t *p_wnd) { BOOL multipleVoutWindows = _voutWindows.count > 0; // setup detached window with controls - NSWindowController *o_controller = [[NSWindowController alloc] initWithWindowNibName:@"DetachedVideoWindow"]; - [o_controller loadWindow]; - VLCVideoWindowCommon *newVideoWindow = (VLCDetachedVideoWindow *)o_controller.window; + NSWindowStyleMask mask = NSWindowStyleMaskClosable | + NSWindowStyleMaskMiniaturizable | + NSWindowStyleMaskResizable | + NSWindowStyleMaskTitled | + NSWindowStyleMaskFullSizeContentView; + VLCVideoWindowCommon *newVideoWindow = [[VLCAspectRatioRetainingVideoWindow alloc] initWithContentRect:NSMakeRect(0,0,300,300) + styleMask:mask + backing:NSBackingStoreBuffered + defer:YES]; + + newVideoWindow.backgroundColor = [NSColor blackColor]; + newVideoWindow.canBecomeKeyWindow = YES; + newVideoWindow.canBecomeMainWindow = YES; + newVideoWindow.acceptsMouseMovedEvents = YES; + newVideoWindow.movableByWindowBackground = YES; + newVideoWindow.minSize = NSMakeSize(VLCVideoWindowCommonMinimalHeight, VLCVideoWindowCommonMinimalHeight); + newVideoWindow.titlebarAppearsTransparent = YES; + + newVideoWindow.videoViewController = [[VLCMainVideoViewController alloc] init]; + newVideoWindow.videoViewController.displayLibraryControls = NO; + newVideoWindow.videoViewController.view.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable; + newVideoWindow.videoViewController.view.frame = newVideoWindow.contentView.frame; + + [newVideoWindow.contentView addSubview:newVideoWindow.videoViewController.view positioned:NSWindowAbove relativeTo:nil]; // no frame autosave for additional vout windows if (multipleVoutWindows) { @@ -292,6 +313,7 @@ int WindowOpen(vlc_window_t *p_wnd) newVideoWindow.delegate = newVideoWindow; newVideoWindow.level = NSNormalWindowLevel; + [newVideoWindow center]; return newVideoWindow; } @@ -348,12 +370,12 @@ int WindowOpen(vlc_window_t *p_wnd) // set (only!) window origin if specified if (!isEmbedded) { - [self setupWindowOriginForVideoWindow:videoWindow - atPosition:videoViewPosition]; - if ([videoWindow isKindOfClass:[VLCAspectRatioRetainingVideoWindow class]]) { [(VLCAspectRatioRetainingVideoWindow*)videoWindow setNativeVideoSize:videoViewSize]; } + + [self setupWindowOriginForVideoWindow:videoWindow + atPosition:videoViewPosition]; } // cascade windows if we have more than one vout diff --git a/modules/gui/macosx/windows/video/VLCVideoWindowCommon.m b/modules/gui/macosx/windows/video/VLCVideoWindowCommon.m index 2a1df8590b..8c58dac757 100644 --- a/modules/gui/macosx/windows/video/VLCVideoWindowCommon.m +++ b/modules/gui/macosx/windows/video/VLCVideoWindowCommon.m @@ -94,6 +94,7 @@ NSString *VLCWindowShouldShowController = @"VLCWindowShouldShowController"; [o_temp_view setAutoresizingMask:NSViewHeightSizable | NSViewWidthSizable]; _playerController = [[[VLCMain sharedInstance] playlistController] playerController]; + _videoViewController = [[VLCMainVideoViewController alloc] init]; } return self; @@ -106,6 +107,10 @@ NSString *VLCWindowShouldShowController = @"VLCWindowShouldShowController"; - (void)awakeFromNib { + if (_videoViewController == nil) { + _videoViewController = [[VLCMainVideoViewController alloc] init]; + } + NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; [notificationCenter addObserver:self selector:@selector(mediaMetadataChanged:)