]> git.sesse.net Git - vlc/commitdiff
macosx: Fix issue where window vanishes from screen if fullscreen is toggled fast...
authorDavid Fuhrmann <david.fuhrmann@googlemail.com>
Sun, 26 Jan 2014 17:17:21 +0000 (18:17 +0100)
committerDavid Fuhrmann <david.fuhrmann@googlemail.com>
Sun, 26 Jan 2014 17:24:57 +0000 (18:24 +0100)
Extends bool to describe both enter and exit fullscreen transitions.

close #8074

modules/gui/macosx/VLCVoutWindowController.m
modules/gui/macosx/Windows.h
modules/gui/macosx/Windows.m

index 224f12a57a07d58a4659893eeb8291f57ff742b6..76af91b2514dca3e67f57053d0d109e0cdcf8997 100644 (file)
     if(i_level == NSStatusWindowLevel) {
         i_statusLevelWindowCounter++;
         // 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];
     } else {
         if (i_statusLevelWindowCounter > 0)
 
         // fullscreen might be triggered twice (vout event)
         // 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])) {
 
             [o_current_window toggleFullScreen:self];
index e110ba88ae806d04f15ef3ab9d08fbecebc551c8..7916fb50001bac6ef3b982d2b59afd71bc4395f6 100644 (file)
@@ -109,13 +109,13 @@ static const float f_min_video_height = 70.0;
 
     NSTimer *t_hide_mouse_timer;
 
-    // true when the window is in transition for entering lion fullscreen
-    BOOL b_entering_fullscreen_transition;
+    // true when the window is in transition for entering or exiting fullscreen
+    BOOL b_in_fullscreen_transition;
 }
 
 @property (nonatomic, assign) VLCVoutView* videoView;
 @property (readonly) VLCControlsBarCommon* controlsBar;
-@property (readonly) BOOL enteringFullscreenTransition;
+@property (readonly) BOOL inFullscreenTransition;
 
 - (void)setWindowLevel:(NSInteger)i_state;
 
index 73ae04c1d5286ea631354922e7005436314502f5..d50835e3079636de3c0e9997915e1ceff53b487a 100644 (file)
 
 @synthesize videoView=o_video_view;
 @synthesize controlsBar=o_controls_bar;
-@synthesize enteringFullscreenTransition=b_entering_fullscreen_transition;
+@synthesize inFullscreenTransition=b_in_fullscreen_transition;
 
 #pragma mark -
 #pragma mark Init
     if (var_InheritBool(VLCIntf, "video-wallpaper") || [self level] < NSNormalWindowLevel)
         return;
 
-    if (!b_fullscreen && !b_entering_fullscreen_transition)
+    if (!b_fullscreen && !b_in_fullscreen_transition)
         [self setLevel: i_state];
 
     // save it for restore if window is currently minimized or in fullscreen
 
 - (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;
 
     NSRect window_rect = [self getWindowRectForProposedVideoViewSize:nativeVideoSize];
         return proposedFrameSize;
 
     // needed when entering lion fullscreen mode
-    if (b_entering_fullscreen_transition || [self fullscreen])
+    if (b_in_fullscreen_transition || [self fullscreen])
         return proposedFrameSize;
 
     if ([[VLCCoreInteraction sharedInstance] aspectRatioIsLocked]) {
     [NSApp setPresentationOptions:(NSApplicationPresentationFullScreen | NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar)];
 
     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];
     [self setLevel:NSNormalWindowLevel];
 
-    b_entering_fullscreen_transition = YES;
+    b_in_fullscreen_transition = YES;
 
     var_SetBool(pl_Get(VLCIntf), "fullscreen", true);
 
     [NSApp activateIgnoringOtherApps:YES];
 
     [self setFullscreen: YES];
-    b_entering_fullscreen_transition = NO;
+    b_in_fullscreen_transition = NO;
 
     if ([self hasActiveVideo]) {
         [[[VLCMainWindow sharedInstance] fsPanel] setVoutWasUpdated: self];
 
 - (void)windowWillExitFullScreen:(NSNotification *)notification
 {
+    b_in_fullscreen_transition = YES;
     [self setFullscreen: NO];
 
     var_SetBool(pl_Get(VLCIntf), "fullscreen", false);
 
 - (void)windowDidExitFullScreen:(NSNotification *)notification
 {
+    b_in_fullscreen_transition = NO;
+
     [[[VLCMain sharedInstance] voutController] updateWindowLevelForHelperWindows: i_originalLevel];
     [self setLevel:i_originalLevel];
 }
     [o_fullscreen_anim1 startAnimation];
     /* fullscreenAnimation will be unlocked when animation ends */
 
-    b_entering_fullscreen_transition = YES;
+    b_in_fullscreen_transition = YES;
 }
 
 - (void)hasBecomeFullscreen
     if ([self isVisible])
         [self orderOut: self];
 
-    b_entering_fullscreen_transition = NO;
+    b_in_fullscreen_transition = NO;
     [self setFullscreen:YES];
 }
 
         return;
     }
 
+    b_in_fullscreen_transition = YES;
+
     [self setAlphaValue: 0.0];
     [self orderFront: self];
     [[o_video_view window] orderFront: self];
 - (void)hasEndedFullscreen
 {
     [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 */
     /* Make sure we don't see the o_video_view disappearing of the screen during this operation */