[vlc-commits] macosx: try to correctly hide fspanel

David Fuhrmann git at videolan.org
Thu Jun 6 21:11:12 CEST 2013


vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Sun Jun  2 12:00:18 2013 +0200| [daf2eb53fd6463ae7d935aca7e5621e1ae2c9a2e] | committer: David Fuhrmann

macosx: try to correctly hide fspanel

hopefully fixes #8489

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

 modules/gui/macosx/MainWindow.m |    3 ---
 modules/gui/macosx/fspanel.m    |   17 ++++++++++++-----
 modules/gui/macosx/intf.m       |    2 ++
 3 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/modules/gui/macosx/MainWindow.m b/modules/gui/macosx/MainWindow.m
index 8938bb0..a3f2cfe 100644
--- a/modules/gui/macosx/MainWindow.m
+++ b/modules/gui/macosx/MainWindow.m
@@ -802,7 +802,6 @@ static VLCMainWindow *_o_sharedInstance = nil;
 
 - (void)showFullscreenController
 {
-
     id currentWindow = [NSApp keyWindow];
     if ([currentWindow respondsToSelector:@selector(hasActiveVideo)] && [currentWindow hasActiveVideo]) {
         if ([currentWindow respondsToSelector:@selector(fullscreen)] && [currentWindow fullscreen] && ![[currentWindow videoView] isHidden]) {
@@ -810,10 +809,8 @@ static VLCMainWindow *_o_sharedInstance = nil;
             if ([[VLCMain sharedInstance] activeVideoPlayback])
                 [o_fspanel fadeIn];
         }
-
     }
 
-
 }
 
 - (void)makeKeyAndOrderFront: (id)sender
diff --git a/modules/gui/macosx/fspanel.m b/modules/gui/macosx/fspanel.m
index fa145ad..76cc102 100644
--- a/modules/gui/macosx/fspanel.m
+++ b/modules/gui/macosx/fspanel.m
@@ -72,6 +72,8 @@
     if (!isInside)
         [self mouseExited:NULL];
 
+    [self setAnimationBehavior:NSWindowAnimationBehaviorNone];
+
     /* get a notification if VLC isn't the active app anymore */
     [[NSNotificationCenter defaultCenter]
     addObserver: self
@@ -79,7 +81,8 @@
            name: NSApplicationDidResignActiveNotification
          object: NSApp];
 
-    /* get a notification if VLC is the active app again */
+    /* Get a notification if VLC is the active app again.
+     Needed as becomeKeyWindow does not get called when window is activated by clicking */
     [[NSNotificationCenter defaultCenter]
     addObserver: self
        selector: @selector(setActive:)
@@ -170,13 +173,15 @@
 - (void)setNonActive:(id)noData
 {
     b_nonActive = YES;
-    [self orderOut: self];
 
     /* here's fadeOut, just without visibly fading */
     b_displayed = NO;
     [self setAlphaValue:0.0];
     [self setFadeTimer:nil];
+
     b_fadeQueued = NO;
+
+    [self orderOut: self];
 }
 
 - (void)setActive:(id)noData
@@ -195,8 +200,9 @@
         b_voutWasUpdated = NO;
     }
 
-    if ([self alphaValue] < 1.0)
+    if ([self alphaValue] < 1.0) {
         [self setAlphaValue:[self alphaValue]+0.1];
+    }
     if ([self alphaValue] >= 1.0) {
         b_displayed = YES;
         [self setAlphaValue: 1.0];
@@ -218,8 +224,9 @@
         [self fadeIn];
         return;
     }
-    if ([self alphaValue] > 0.0)
+    if ([self alphaValue] > 0.0) {
         [self setAlphaValue:[self alphaValue]-0.05];
+    }
     if ([self alphaValue] <= 0.05) {
         b_displayed = NO;
         [self setAlphaValue:0.0];
@@ -292,7 +299,7 @@
     b_keptVisible = YES;
 
     /* get us a valid timer */
-    if (! b_alreadyCounting) {
+    if (!b_alreadyCounting) {
         i_timeToKeepVisibleInSec = var_CreateGetInteger(VLCIntf, "mouse-hide-timeout") / 500;
         if (hideAgainTimer) {
             [hideAgainTimer invalidate];
diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m
index c07c779..fc8e990 100644
--- a/modules/gui/macosx/intf.m
+++ b/modules/gui/macosx/intf.m
@@ -1379,6 +1379,8 @@ static VLCMain *_o_sharedMainInstance = nil;
 
 - (void)showFullscreenController
 {
+    // defer selector here (possibly another time) to ensure that keyWindow is set properly
+    // (needed for NSApplicationDidBecomeActiveNotification)
     [o_mainwindow performSelectorOnMainThread:@selector(showFullscreenController) withObject:nil waitUntilDone:NO];
 }
 



More information about the vlc-commits mailing list