Commit 0206828a authored by David Fuhrmann's avatar David Fuhrmann

macosx: Fix issue where window vanishes from screen if fullscreen is toggled fast in a row

Extends bool to describe both enter and exit fullscreen transitions.

close #8074
parent 38e14c07
...@@ -287,7 +287,7 @@ ...@@ -287,7 +287,7 @@
if(i_level == NSStatusWindowLevel) { if(i_level == NSStatusWindowLevel) {
i_statusLevelWindowCounter++; i_statusLevelWindowCounter++;
// window level need to stay on normal in fullscreen mode // window level need to stay on normal in fullscreen mode
if (![o_window fullscreen] && ![o_window enteringFullscreenTransition]) if (![o_window fullscreen] && ![o_window inFullscreenTransition])
[self updateWindowLevelForHelperWindows:i_level]; [self updateWindowLevelForHelperWindows:i_level];
} else { } else {
if (i_statusLevelWindowCounter > 0) if (i_statusLevelWindowCounter > 0)
...@@ -325,7 +325,7 @@ ...@@ -325,7 +325,7 @@
// fullscreen might be triggered twice (vout event) // fullscreen might be triggered twice (vout event)
// so ignore duplicate events here // so ignore duplicate events here
if((b_fullscreen && !([o_current_window fullscreen] || [o_current_window enteringFullscreenTransition])) || if((b_fullscreen && !([o_current_window fullscreen] || [o_current_window inFullscreenTransition])) ||
(!b_fullscreen && [o_current_window fullscreen])) { (!b_fullscreen && [o_current_window fullscreen])) {
[o_current_window toggleFullScreen:self]; [o_current_window toggleFullScreen:self];
......
...@@ -109,13 +109,13 @@ static const float f_min_video_height = 70.0; ...@@ -109,13 +109,13 @@ static const float f_min_video_height = 70.0;
NSTimer *t_hide_mouse_timer; NSTimer *t_hide_mouse_timer;
// true when the window is in transition for entering lion fullscreen // true when the window is in transition for entering or exiting fullscreen
BOOL b_entering_fullscreen_transition; BOOL b_in_fullscreen_transition;
} }
@property (nonatomic, assign) VLCVoutView* videoView; @property (nonatomic, assign) VLCVoutView* videoView;
@property (readonly) VLCControlsBarCommon* controlsBar; @property (readonly) VLCControlsBarCommon* controlsBar;
@property (readonly) BOOL enteringFullscreenTransition; @property (readonly) BOOL inFullscreenTransition;
- (void)setWindowLevel:(NSInteger)i_state; - (void)setWindowLevel:(NSInteger)i_state;
......
...@@ -249,7 +249,7 @@ ...@@ -249,7 +249,7 @@
@synthesize videoView=o_video_view; @synthesize videoView=o_video_view;
@synthesize controlsBar=o_controls_bar; @synthesize controlsBar=o_controls_bar;
@synthesize enteringFullscreenTransition=b_entering_fullscreen_transition; @synthesize inFullscreenTransition=b_in_fullscreen_transition;
#pragma mark - #pragma mark -
#pragma mark Init #pragma mark Init
...@@ -465,7 +465,7 @@ ...@@ -465,7 +465,7 @@
if (var_InheritBool(VLCIntf, "video-wallpaper") || [self level] < NSNormalWindowLevel) if (var_InheritBool(VLCIntf, "video-wallpaper") || [self level] < NSNormalWindowLevel)
return; return;
if (!b_fullscreen && !b_entering_fullscreen_transition) if (!b_fullscreen && !b_in_fullscreen_transition)
[self setLevel: i_state]; [self setLevel: i_state];
// save it for restore if window is currently minimized or in fullscreen // save it for restore if window is currently minimized or in fullscreen
...@@ -516,7 +516,9 @@ ...@@ -516,7 +516,9 @@
- (void)resizeWindow - (void)resizeWindow
{ {
if ([self fullscreen]) // VOUT_WINDOW_SET_SIZE is triggered when exiting fullscreen. This event is ignored here
// to avoid interference with the animation.
if ([self fullscreen] || b_in_fullscreen_transition)
return; return;
NSRect window_rect = [self getWindowRectForProposedVideoViewSize:nativeVideoSize]; NSRect window_rect = [self getWindowRectForProposedVideoViewSize:nativeVideoSize];
...@@ -537,7 +539,7 @@ ...@@ -537,7 +539,7 @@
return proposedFrameSize; return proposedFrameSize;
// needed when entering lion fullscreen mode // needed when entering lion fullscreen mode
if (b_entering_fullscreen_transition || [self fullscreen]) if (b_in_fullscreen_transition || [self fullscreen])
return proposedFrameSize; return proposedFrameSize;
if ([[VLCCoreInteraction sharedInstance] aspectRatioIsLocked]) { if ([[VLCCoreInteraction sharedInstance] aspectRatioIsLocked]) {
...@@ -628,11 +630,11 @@ ...@@ -628,11 +630,11 @@
[NSApp setPresentationOptions:(NSApplicationPresentationFullScreen | NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar)]; [NSApp setPresentationOptions:(NSApplicationPresentationFullScreen | NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar)];
i_originalLevel = [self level]; i_originalLevel = [self level];
// b_fullscreen and b_entering_fullscreen_transition must not be true yet // b_fullscreen and b_in_fullscreen_transition must not be true yet
[[[VLCMain sharedInstance] voutController] updateWindowLevelForHelperWindows: NSNormalWindowLevel]; [[[VLCMain sharedInstance] voutController] updateWindowLevelForHelperWindows: NSNormalWindowLevel];
[self setLevel:NSNormalWindowLevel]; [self setLevel:NSNormalWindowLevel];
b_entering_fullscreen_transition = YES; b_in_fullscreen_transition = YES;
var_SetBool(pl_Get(VLCIntf), "fullscreen", true); var_SetBool(pl_Get(VLCIntf), "fullscreen", true);
...@@ -674,7 +676,7 @@ ...@@ -674,7 +676,7 @@
[NSApp activateIgnoringOtherApps:YES]; [NSApp activateIgnoringOtherApps:YES];
[self setFullscreen: YES]; [self setFullscreen: YES];
b_entering_fullscreen_transition = NO; b_in_fullscreen_transition = NO;
if ([self hasActiveVideo]) { if ([self hasActiveVideo]) {
[[[VLCMainWindow sharedInstance] fsPanel] setVoutWasUpdated: self]; [[[VLCMainWindow sharedInstance] fsPanel] setVoutWasUpdated: self];
...@@ -694,6 +696,7 @@ ...@@ -694,6 +696,7 @@
- (void)windowWillExitFullScreen:(NSNotification *)notification - (void)windowWillExitFullScreen:(NSNotification *)notification
{ {
b_in_fullscreen_transition = YES;
[self setFullscreen: NO]; [self setFullscreen: NO];
var_SetBool(pl_Get(VLCIntf), "fullscreen", false); var_SetBool(pl_Get(VLCIntf), "fullscreen", false);
...@@ -741,6 +744,8 @@ ...@@ -741,6 +744,8 @@
- (void)windowDidExitFullScreen:(NSNotification *)notification - (void)windowDidExitFullScreen:(NSNotification *)notification
{ {
b_in_fullscreen_transition = NO;
[[[VLCMain sharedInstance] voutController] updateWindowLevelForHelperWindows: i_originalLevel]; [[[VLCMain sharedInstance] voutController] updateWindowLevelForHelperWindows: i_originalLevel];
[self setLevel:i_originalLevel]; [self setLevel:i_originalLevel];
} }
...@@ -900,7 +905,7 @@ ...@@ -900,7 +905,7 @@
[o_fullscreen_anim1 startAnimation]; [o_fullscreen_anim1 startAnimation];
/* fullscreenAnimation will be unlocked when animation ends */ /* fullscreenAnimation will be unlocked when animation ends */
b_entering_fullscreen_transition = YES; b_in_fullscreen_transition = YES;
} }
- (void)hasBecomeFullscreen - (void)hasBecomeFullscreen
...@@ -918,7 +923,7 @@ ...@@ -918,7 +923,7 @@
if ([self isVisible]) if ([self isVisible])
[self orderOut: self]; [self orderOut: self];
b_entering_fullscreen_transition = NO; b_in_fullscreen_transition = NO;
[self setFullscreen:YES]; [self setFullscreen:YES];
} }
...@@ -975,6 +980,8 @@ ...@@ -975,6 +980,8 @@
return; return;
} }
b_in_fullscreen_transition = YES;
[self setAlphaValue: 0.0]; [self setAlphaValue: 0.0];
[self orderFront: self]; [self orderFront: self];
[[o_video_view window] orderFront: self]; [[o_video_view window] orderFront: self];
...@@ -1032,6 +1039,7 @@ ...@@ -1032,6 +1039,7 @@
- (void)hasEndedFullscreen - (void)hasEndedFullscreen
{ {
[self setFullscreen:NO]; [self setFullscreen:NO];
b_in_fullscreen_transition = NO;
/* This function is private and should be only triggered at the end of the fullscreen change animation */ /* This function is private and should be only triggered at the end of the fullscreen change animation */
/* Make sure we don't see the o_video_view disappearing of the screen during this operation */ /* Make sure we don't see the o_video_view disappearing of the screen during this operation */
......
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