Browse Source

macosx: Extract video window's dismissal procedure to block variable, reuse for playback end view dismissal handling

Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
pull/183/head
Claudio Cambra 10 months ago
committed by Steve Lhomme
parent
commit
74a2a16b88
  1. 1
      modules/gui/macosx/windows/video/VLCMainVideoViewController.h
  2. 7
      modules/gui/macosx/windows/video/VLCMainVideoViewController.m
  3. 16
      modules/gui/macosx/windows/video/VLCVideoOutputProvider.m

1
modules/gui/macosx/windows/video/VLCMainVideoViewController.h

@ -66,6 +66,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (readonly) BOOL pipIsActive;
@property (readonly) VLCPlaybackEndViewController *playbackEndViewController;
@property (readwrite) void (^endViewDismissHandler)(void);
- (void)showControls;
- (void)hideControls;

7
modules/gui/macosx/windows/video/VLCMainVideoViewController.m

@ -608,12 +608,17 @@
- (void)playbackEndViewReturnToLibrary:(NSNotification *)notification
{
[self returnToLibrary:self];
if (self.endViewDismissHandler)
self.endViewDismissHandler();
else
[self returnToLibrary:self];
}
- (void)playbackEndViewHide:(NSNotification *)notification
{
[self.playbackEndViewController.view removeFromSuperview];
if (self.endViewDismissHandler)
self.endViewDismissHandler();
}
#pragma mark - PIPViewControllerDelegate

16
modules/gui/macosx/windows/video/VLCVideoOutputProvider.m

@ -531,16 +531,22 @@ static int WindowFloatOnTop(vlc_object_t *obj,
const BOOL endOfPlaybackScreenEnabled =
[NSUserDefaults.standardUserDefaults boolForKey:VLCPlaybackEndViewEnabledKey];
// we need to check that the player itself is in a stopped state. Removal of the active video
// can be triggered by more than just end of playback (e.g. disabling the video track).
if (!decorativeViewVisible && endOfPlaybackScreenEnabled && playerController.playerState == VLC_PLAYER_STATE_STOPPED) {
[videoWindow.videoViewController displayPlaybackEndView];
} else if (!decorativeViewVisible) {
void (^windowVideoDismissProcedure)(void) = ^{
if (videoWindow.class == VLCLibraryWindow.class && !videoWindow.videoViewController.view.hidden) {
[(VLCLibraryWindow *)videoWindow disableVideoPlaybackAppearance];
} else {
[videoWindow close];
}
};
// we need to check that the player itself is in a stopped state. Removal of the active video
// can be triggered by more than just end of playback (e.g. disabling the video track).
if (!decorativeViewVisible && endOfPlaybackScreenEnabled && playerController.playerState == VLC_PLAYER_STATE_STOPPED) {
[videoWindow.videoViewController displayPlaybackEndView];
videoWindow.videoViewController.endViewDismissHandler = windowVideoDismissProcedure;
} else if (!decorativeViewVisible) {
windowVideoDismissProcedure();
}
[NSAnimationContext endGrouping];

Loading…
Cancel
Save