vlc | branch: master | Felix Paul Kühne <[email protected]> | Mon Apr 15 20:10:59 2019 +0200| [13e36ea0a1a2962da81e6bcb4ca8647e56a5a910] | committer: Felix Paul Kühne
macosx/library window: don't block access to the playlist when using the detached vout window mode > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=13e36ea0a1a2962da81e6bcb4ca8647e56a5a910 --- modules/gui/macosx/library/VLCLibraryWindow.h | 3 +- modules/gui/macosx/library/VLCLibraryWindow.m | 60 ++++++++++++---------- modules/gui/macosx/main/VLCMain.m | 2 +- .../macosx/windows/video/VLCVideoOutputProvider.m | 29 ++++++----- 4 files changed, 51 insertions(+), 43 deletions(-) diff --git a/modules/gui/macosx/library/VLCLibraryWindow.h b/modules/gui/macosx/library/VLCLibraryWindow.h index 52e30edbb3..c81f371a03 100644 --- a/modules/gui/macosx/library/VLCLibraryWindow.h +++ b/modules/gui/macosx/library/VLCLibraryWindow.h @@ -40,7 +40,8 @@ NS_ASSUME_NONNULL_BEGIN @property (readwrite) BOOL nonembedded; - (void)videoPlaybackWillBeStarted; -- (void)toggleVideoPlaybackAppearance; +- (void)enableVideoPlaybackAppearance; +- (void)disableVideoPlaybackAppearance; - (IBAction)playlistDoubleClickAction:(id)sender; diff --git a/modules/gui/macosx/library/VLCLibraryWindow.m b/modules/gui/macosx/library/VLCLibraryWindow.m index 3fadea55a3..c0b050d072 100644 --- a/modules/gui/macosx/library/VLCLibraryWindow.m +++ b/modules/gui/macosx/library/VLCLibraryWindow.m @@ -113,44 +113,48 @@ static NSString *VLCLibraryCellIdentifier = @"VLCLibraryCellIdentifier"; _windowFrameBeforePlayback = [self frame]; } -- (void)toggleVideoPlaybackAppearance +- (void)enableVideoPlaybackAppearance { - BOOL b_videoPlayback = [[VLCMain sharedInstance] activeVideoPlayback]; + [self.videoView setHidden:NO]; - if (!b_videoPlayback) { - if (!self.nonembedded && (!self.nativeFullscreenMode || (self.nativeFullscreenMode && !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 = f_min_video_height + [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]; + if (self.nativeFullscreenMode) { + if ([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) { + + // only resize back to minimum view of this is still desired final state + CGFloat f_threshold_height = f_min_video_height + [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); + _windowFrameBeforePlayback = NSMakeRect(0, 0, 0, 0); - [self makeFirstResponder: _playlistTableView]; - [[[VLCMain sharedInstance] voutProvider] updateWindowLevelForHelperWindows: NSNormalWindowLevel]; + [self makeFirstResponder: _playlistTableView]; + [[[VLCMain sharedInstance] voutProvider] updateWindowLevelForHelperWindows: NSNormalWindowLevel]; - // restore alpha value to 1 for the case that macosx-opaqueness is set to < 1 - [self setAlphaValue:1.0]; - [self.videoView setHidden:YES]; - } else { - [self.videoView setHidden:NO]; - } + // restore alpha value to 1 for the case that macosx-opaqueness is set to < 1 + [self setAlphaValue:1.0]; + [self.videoView setHidden:YES]; if (self.nativeFullscreenMode) { - if ([self hasActiveVideo] && [self fullscreen] && b_videoPlayback) { - [self hideControlsBar]; - [_fspanel shouldBecomeActive:nil]; - } else { - [self showControlsBar]; - [_fspanel shouldBecomeInactive:nil]; - } + [self showControlsBar]; + [_fspanel shouldBecomeInactive:nil]; } } diff --git a/modules/gui/macosx/main/VLCMain.m b/modules/gui/macosx/main/VLCMain.m index 5191baf799..5bd4cb418b 100644 --- a/modules/gui/macosx/main/VLCMain.m +++ b/modules/gui/macosx/main/VLCMain.m @@ -451,7 +451,7 @@ static VLCMain *sharedInstance = nil; b_active_videoplayback = b_value; if ([self libraryWindow]) { - [[self libraryWindow] toggleVideoPlaybackAppearance]; +// [[self libraryWindow] toggleVideoPlaybackAppearance]; } } diff --git a/modules/gui/macosx/windows/video/VLCVideoOutputProvider.m b/modules/gui/macosx/windows/video/VLCVideoOutputProvider.m index 64df32e579..5261f219dc 100644 --- a/modules/gui/macosx/windows/video/VLCVideoOutputProvider.m +++ b/modules/gui/macosx/windows/video/VLCVideoOutputProvider.m @@ -291,6 +291,7 @@ int WindowOpen(vout_window_t *p_wnd) voutView = [newVideoWindow videoView]; b_mainWindowHasVideo = YES; isEmbedded = YES; + [(VLCLibraryWindow *)newVideoWindow enableVideoPlaybackAppearance]; } else { // setup detached window with controls NSWindowController *o_controller = [[NSWindowController alloc] initWithWindowNibName:@"DetachedVideoWindow"]; @@ -375,47 +376,49 @@ int WindowOpen(vout_window_t *p_wnd) return voutView; } -- (void)removeVoutForDisplay:(NSValue *)o_key +- (void)removeVoutForDisplay:(NSValue *)key { VLCMain *mainInstance = [VLCMain sharedInstance]; - VLCVideoWindowCommon *o_window = [_voutWindows objectForKey:o_key]; - if (!o_window) { + VLCVideoWindowCommon *videoWindow = [_voutWindows objectForKey:key]; + if (!videoWindow) { msg_Err(getIntf(), "Cannot close nonexisting window"); return; } - [[o_window videoView] releaseVoutThread]; + [[videoWindow videoView] releaseVoutThread]; // set active video to no BEFORE closing the window and exiting fullscreen // (avoid stopping playback due to NSWindowWillCloseNotification, preserving fullscreen state) - [o_window setHasActiveVideo: NO]; + [videoWindow setHasActiveVideo: NO]; // prevent visible extra window if in fullscreen NSDisableScreenUpdates(); BOOL b_native = [[mainInstance libraryWindow] nativeFullscreenMode]; // close fullscreen, without changing fullscreen vars - if (!b_native && ([o_window fullscreen] || [o_window inFullscreenTransition])) - [o_window leaveFullscreenWithAnimation:NO]; + if (!b_native && ([videoWindow fullscreen] || [videoWindow inFullscreenTransition])) + [videoWindow leaveFullscreenWithAnimation:NO]; // native fullscreen window will not be closed if // fullscreen was triggered without video - if ((b_native && [o_window class] == [VLCLibraryWindow class] && [o_window fullscreen] && [o_window windowShouldExitFullscreenWhenFinished])) { - [o_window toggleFullScreen:self]; + if ((b_native && [videoWindow class] == [VLCLibraryWindow class] && [videoWindow fullscreen] && [videoWindow windowShouldExitFullscreenWhenFinished])) { + [videoWindow toggleFullScreen:self]; } - if ([o_window class] != [VLCLibraryWindow class]) { - [o_window close]; + if ([videoWindow class] != [VLCLibraryWindow class]) { + [videoWindow close]; + } else { + [(VLCLibraryWindow *)videoWindow disableVideoPlaybackAppearance]; } NSEnableScreenUpdates(); - [_voutWindows removeObjectForKey:o_key]; + [_voutWindows removeObjectForKey:key]; if ([_voutWindows count] == 0) { [mainInstance setActiveVideoPlayback:NO]; _statusLevelWindowCounter = 0; } - if ([o_window class] == [VLCLibraryWindow class]) { + if ([videoWindow class] == [VLCLibraryWindow class]) { b_mainWindowHasVideo = NO; // video in main window might get stopped while another vout is open _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
