Commit 0011c261 authored by David Fuhrmann's avatar David Fuhrmann

macosx: reactivate fast path for exiting fullscreen window when video finished

This also removes old workarounds which are not needed anymore.

close #10826
parent 4aafb963
...@@ -249,8 +249,11 @@ ...@@ -249,8 +249,11 @@
return; return;
} }
if ([o_window fullscreen] && ![[VLCMainWindow sharedInstance] nativeFullscreenMode]) // prevent visible extra window if in fullscreen
[o_window leaveFullscreen]; NSDisableScreenUpdates();
if (![[VLCMainWindow sharedInstance] nativeFullscreenMode] &&
([o_window fullscreen] || [o_window inFullscreenTransition]))
[o_window leaveFullscreenWithAnimation: NO];
[[o_window videoView] releaseVoutThread]; [[o_window videoView] releaseVoutThread];
...@@ -261,6 +264,7 @@ ...@@ -261,6 +264,7 @@
if ([o_window class] != [VLCMainWindow class]) { if ([o_window class] != [VLCMainWindow class]) {
[o_window close]; [o_window close];
} }
NSEnableScreenUpdates();
[o_window retain]; [o_window retain];
[o_vout_dict removeObjectForKey:o_key]; [o_vout_dict removeObjectForKey:o_key];
...@@ -370,7 +374,7 @@ ...@@ -370,7 +374,7 @@
vlc_object_release(p_input); vlc_object_release(p_input);
} else { } else {
// leaving fullscreen is always allowed // leaving fullscreen is always allowed
[o_current_window leaveFullscreen]; [o_current_window leaveFullscreenWithAnimation:YES];
} }
} }
} }
......
...@@ -98,10 +98,8 @@ static const float f_min_video_height = 70.0; ...@@ -98,10 +98,8 @@ static const float f_min_video_height = 70.0;
VLCWindow * o_fullscreen_window; VLCWindow * o_fullscreen_window;
NSViewAnimation * o_fullscreen_anim1; NSViewAnimation * o_fullscreen_anim1;
NSViewAnimation * o_fullscreen_anim2; NSViewAnimation * o_fullscreen_anim2;
NSViewAnimation * o_makekey_anim;
NSView * o_temp_view; NSView * o_temp_view;
BOOL b_window_is_invisible;
NSInteger i_originalLevel; NSInteger i_originalLevel;
BOOL b_video_view_was_hidden; BOOL b_video_view_was_hidden;
...@@ -129,7 +127,7 @@ static const float f_min_video_height = 70.0; ...@@ -129,7 +127,7 @@ static const float f_min_video_height = 70.0;
/* fullscreen handling */ /* fullscreen handling */
- (void)enterFullscreen; - (void)enterFullscreen;
- (void)leaveFullscreen; - (void)leaveFullscreenWithAnimation:(BOOL)b_animation;
/* lion fullscreen handling */ /* lion fullscreen handling */
- (void)windowWillEnterFullScreen:(NSNotification *)notification; - (void)windowWillEnterFullScreen:(NSNotification *)notification;
......
...@@ -275,7 +275,6 @@ ...@@ -275,7 +275,6 @@
@interface VLCVideoWindowCommon (Internal) @interface VLCVideoWindowCommon (Internal)
- (void)customZoom:(id)sender; - (void)customZoom:(id)sender;
- (void)hasBecomeFullscreen; - (void)hasBecomeFullscreen;
- (void)leaveFullscreenAndFadeOut:(BOOL)fadeout;
- (void)hasEndedFullscreen; - (void)hasEndedFullscreen;
@end @end
...@@ -1007,12 +1006,7 @@ ...@@ -1007,12 +1006,7 @@
[self setFullscreen:YES]; [self setFullscreen:YES];
} }
- (void)leaveFullscreen - (void)leaveFullscreenWithAnimation:(BOOL)b_animation
{
[self leaveFullscreenAndFadeOut: NO];
}
- (void)leaveFullscreenAndFadeOut: (BOOL)fadeout
{ {
NSMutableDictionary *dict1, *dict2; NSMutableDictionary *dict1, *dict2;
NSRect frame; NSRect frame;
...@@ -1032,7 +1026,21 @@ ...@@ -1032,7 +1026,21 @@
return; return;
} }
if (fadeout) { [[[VLCMainWindow sharedInstance] fsPanel] setNonActive: nil];
[[o_fullscreen_window screen] setNonFullscreenPresentationOptions];
if (o_fullscreen_anim1) {
[o_fullscreen_anim1 stopAnimation];
[o_fullscreen_anim1 release];
o_fullscreen_anim1 = nil;
}
if (o_fullscreen_anim2) {
[o_fullscreen_anim2 stopAnimation];
[o_fullscreen_anim2 release];
o_fullscreen_anim2 = nil;
}
if (!b_animation) {
/* We don't animate if we are not visible, instead we /* We don't animate if we are not visible, instead we
* simply fade the display */ * simply fade the display */
CGDisplayFadeReservationToken token; CGDisplayFadeReservationToken token;
...@@ -1042,16 +1050,12 @@ ...@@ -1042,16 +1050,12 @@
CGDisplayFade(token, 0.3, kCGDisplayBlendNormal, kCGDisplayBlendSolidColor, 0, 0, 0, YES); CGDisplayFade(token, 0.3, kCGDisplayBlendNormal, kCGDisplayBlendSolidColor, 0, 0, 0, YES);
} }
[[[VLCMainWindow sharedInstance] fsPanel] setNonActive: nil]; [self setAlphaValue:1.0];
[[o_fullscreen_window screen] setNonFullscreenPresentationOptions]; [self orderFront: self];
/* Will release the lock */ /* Will release the lock */
[self hasEndedFullscreen]; [self hasEndedFullscreen];
/* Our window is hidden, and might be faded. We need to workaround that, so note it
* here */
b_window_is_invisible = YES;
if (blackout_other_displays) { if (blackout_other_displays) {
CGDisplayFade(token, 0.5, kCGDisplayBlendSolidColor, kCGDisplayBlendNormal, 0, 0, 0, NO); CGDisplayFade(token, 0.5, kCGDisplayBlendSolidColor, kCGDisplayBlendNormal, 0, 0, 0, NO);
CGReleaseDisplayFadeReservation(token); CGReleaseDisplayFadeReservation(token);
...@@ -1066,18 +1070,6 @@ ...@@ -1066,18 +1070,6 @@
[self orderFront: self]; [self orderFront: self];
[[o_video_view window] orderFront: self]; [[o_video_view window] orderFront: self];
[[[VLCMainWindow sharedInstance] fsPanel] setNonActive: nil];
[[o_fullscreen_window screen] setNonFullscreenPresentationOptions];
if (o_fullscreen_anim1) {
[o_fullscreen_anim1 stopAnimation];
[o_fullscreen_anim1 release];
}
if (o_fullscreen_anim2) {
[o_fullscreen_anim2 stopAnimation];
[o_fullscreen_anim2 release];
}
frame = [[o_temp_view superview] convertRect: [o_temp_view frame] toView: nil]; /* Convert to Window base coord */ frame = [[o_temp_view superview] convertRect: [o_temp_view frame] toView: nil]; /* Convert to Window base coord */
frame.origin.x += [self frame].origin.x; frame.origin.x += [self frame].origin.x;
frame.origin.y += [self frame].origin.y; frame.origin.y += [self frame].origin.y;
...@@ -1134,7 +1126,7 @@ ...@@ -1134,7 +1126,7 @@
[o_video_view setHidden: b_video_view_was_hidden]; [o_video_view setHidden: b_video_view_was_hidden];
[super makeKeyAndOrderFront:self]; /* our version (in main window) contains a workaround */ [self makeKeyAndOrderFront:self];
[o_fullscreen_window orderOut: self]; [o_fullscreen_window orderOut: self];
NSEnableScreenUpdates(); NSEnableScreenUpdates();
...@@ -1146,19 +1138,11 @@ ...@@ -1146,19 +1138,11 @@
[self setLevel:i_originalLevel]; [self setLevel:i_originalLevel];
[self setAlphaValue: config_GetFloat(VLCIntf, "macosx-opaqueness")]; [self setAlphaValue: config_GetFloat(VLCIntf, "macosx-opaqueness")];
// if we quit fullscreen because there is no video anymore, make sure non-embedded window is not visible
if (![[VLCMain sharedInstance] activeVideoPlayback] && [self class] != [VLCMainWindow class])
[self orderOut: self];
} }
- (void)animationDidEnd:(NSAnimation*)animation - (void)animationDidEnd:(NSAnimation*)animation
{ {
NSArray *viewAnimations; NSArray *viewAnimations;
if (o_makekey_anim == animation) {
[o_makekey_anim release];
return;
}
if ([animation currentValue] < 1.0) if ([animation currentValue] < 1.0)
return; return;
...@@ -1173,55 +1157,6 @@ ...@@ -1173,55 +1157,6 @@
[self hasBecomeFullscreen]; [self hasBecomeFullscreen];
} }
- (void)orderOut:(id)sender
{
[super orderOut:sender];
/*
* TODO reimplement leaveFullscreenAndFadeOut:YES, or remove code
* and the hack below
if (![NSStringFromClass([self class]) isEqualToString:@"VLCMainWindow"]) {
[self leaveFullscreenAndFadeOut:YES];
}
*/
}
- (void)makeKeyAndOrderFront: (id)sender
{
/* Hack
* when we exit fullscreen and fade out, we may endup in
* having a window that is faded. We can't have it fade in unless we
* animate again. */
if (!b_window_is_invisible) {
/* Make sure we don't do it too much */
[super makeKeyAndOrderFront: sender];
return;
}
[super setAlphaValue:0.0f];
[super makeKeyAndOrderFront: sender];
NSMutableDictionary * dict = [[NSMutableDictionary alloc] initWithCapacity:2];
[dict setObject:self forKey:NSViewAnimationTargetKey];
[dict setObject:NSViewAnimationFadeInEffect forKey:NSViewAnimationEffectKey];
o_makekey_anim = [[NSViewAnimation alloc] initWithViewAnimations:[NSArray arrayWithObject:dict]];
[dict release];
[o_makekey_anim setAnimationBlockingMode: NSAnimationNonblocking];
[o_makekey_anim setDuration: 0.1];
[o_makekey_anim setFrameRate: 30];
[o_makekey_anim setDelegate: self];
[o_makekey_anim startAnimation];
b_window_is_invisible = NO;
/* fullscreenAnimation will be unlocked when animation ends */
}
#pragma mark - #pragma mark -
#pragma mark Accessibility stuff #pragma mark Accessibility stuff
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment