[vlc-commits] macosx: Fix issue where window vanishes from screen if fullscreen is toggled fast in a row

David Fuhrmann git at videolan.org
Sun Jan 26 18:26:14 CET 2014


vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Sun Jan 26 18:17:21 2014 +0100| [0206828ae8f09f856bd4ee02b112202b977f7cc9] | committer: 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

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0206828ae8f09f856bd4ee02b112202b977f7cc9
---

 modules/gui/macosx/VLCVoutWindowController.m |    4 ++--
 modules/gui/macosx/Windows.h                 |    6 +++---
 modules/gui/macosx/Windows.m                 |   26 +++++++++++++++++---------
 3 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/modules/gui/macosx/VLCVoutWindowController.m b/modules/gui/macosx/VLCVoutWindowController.m
index 224f12a..76af91b 100644
--- a/modules/gui/macosx/VLCVoutWindowController.m
+++ b/modules/gui/macosx/VLCVoutWindowController.m
@@ -287,7 +287,7 @@
     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)
@@ -325,7 +325,7 @@
 
         // 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];
diff --git a/modules/gui/macosx/Windows.h b/modules/gui/macosx/Windows.h
index e110ba8..7916fb5 100644
--- a/modules/gui/macosx/Windows.h
+++ b/modules/gui/macosx/Windows.h
@@ -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;
- at property (readonly) BOOL enteringFullscreenTransition;
+ at property (readonly) BOOL inFullscreenTransition;
 
 - (void)setWindowLevel:(NSInteger)i_state;
 
diff --git a/modules/gui/macosx/Windows.m b/modules/gui/macosx/Windows.m
index 73ae04c..d50835e 100644
--- a/modules/gui/macosx/Windows.m
+++ b/modules/gui/macosx/Windows.m
@@ -249,7 +249,7 @@
 
 @synthesize videoView=o_video_view;
 @synthesize controlsBar=o_controls_bar;
- at synthesize enteringFullscreenTransition=b_entering_fullscreen_transition;
+ at synthesize inFullscreenTransition=b_in_fullscreen_transition;
 
 #pragma mark -
 #pragma mark Init
@@ -465,7 +465,7 @@
     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
@@ -516,7 +516,9 @@
 
 - (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];
@@ -537,7 +539,7 @@
         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]) {
@@ -628,11 +630,11 @@
     [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);
 
@@ -674,7 +676,7 @@
     [NSApp activateIgnoringOtherApps:YES];
 
     [self setFullscreen: YES];
-    b_entering_fullscreen_transition = NO;
+    b_in_fullscreen_transition = NO;
 
     if ([self hasActiveVideo]) {
         [[[VLCMainWindow sharedInstance] fsPanel] setVoutWasUpdated: self];
@@ -694,6 +696,7 @@
 
 - (void)windowWillExitFullScreen:(NSNotification *)notification
 {
+    b_in_fullscreen_transition = YES;
     [self setFullscreen: NO];
 
     var_SetBool(pl_Get(VLCIntf), "fullscreen", false);
@@ -741,6 +744,8 @@
 
 - (void)windowDidExitFullScreen:(NSNotification *)notification
 {
+    b_in_fullscreen_transition = NO;
+
     [[[VLCMain sharedInstance] voutController] updateWindowLevelForHelperWindows: i_originalLevel];
     [self setLevel:i_originalLevel];
 }
@@ -900,7 +905,7 @@
     [o_fullscreen_anim1 startAnimation];
     /* fullscreenAnimation will be unlocked when animation ends */
 
-    b_entering_fullscreen_transition = YES;
+    b_in_fullscreen_transition = YES;
 }
 
 - (void)hasBecomeFullscreen
@@ -918,7 +923,7 @@
     if ([self isVisible])
         [self orderOut: self];
 
-    b_entering_fullscreen_transition = NO;
+    b_in_fullscreen_transition = NO;
     [self setFullscreen:YES];
 }
 
@@ -975,6 +980,8 @@
         return;
     }
 
+    b_in_fullscreen_transition = YES;
+
     [self setAlphaValue: 0.0];
     [self orderFront: self];
     [[o_video_view window] orderFront: self];
@@ -1032,6 +1039,7 @@
 - (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 */



More information about the vlc-commits mailing list