[vlc-devel] commit: macosx: Make sure makeKeyAndOrderFront doesn' t hide and then display the window if it was visible and not faded. ( Pierre d'Herbemont )

git version control git at videolan.org
Sat Jul 12 23:17:25 CEST 2008


vlc | branch: master | Pierre d'Herbemont <pdherbemont at videolan.org> | Sat Jul 12 23:19:40 2008 +0200| [d521d1d313824f2966862fc6d6c7e4d72d2d9b23]

macosx: Make sure makeKeyAndOrderFront doesn't hide and then display the window if it was visible and not faded.

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

 modules/gui/macosx/embeddedwindow.h |    2 ++
 modules/gui/macosx/embeddedwindow.m |   14 ++++++++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/modules/gui/macosx/embeddedwindow.h b/modules/gui/macosx/embeddedwindow.h
index 39da8e9..e8e408d 100644
--- a/modules/gui/macosx/embeddedwindow.h
+++ b/modules/gui/macosx/embeddedwindow.h
@@ -49,6 +49,8 @@
     /* set to yes if we are fullscreen and all animations are over */
     BOOL              b_fullscreen;
     NSRecursiveLock * o_animation_lock;
+
+    BOOL              b_window_is_invisible;
 }
 
 - (void)controlTintChanged;
diff --git a/modules/gui/macosx/embeddedwindow.m b/modules/gui/macosx/embeddedwindow.m
index d7cd72c..774e18d 100644
--- a/modules/gui/macosx/embeddedwindow.m
+++ b/modules/gui/macosx/embeddedwindow.m
@@ -72,6 +72,7 @@
 
     /* Make sure setVisible: returns NO */
     [self orderOut:self];
+    b_window_is_invisible = YES;
 }
 
 - (void)controlTintChanged
@@ -399,6 +400,10 @@
         /* Will release the lock */
         [self hasEndedFullscreen];
 
+        /* Our window is hidden, and might be faded. We need to workaround that, so note it
+         * here */
+        b_window_is_invisible = YES;
+
         CGDisplayFade( token, 0.5, kCGDisplayBlendSolidColor, kCGDisplayBlendNormal, 0, 0, 0, NO );
         CGReleaseDisplayFadeReservation( token);
         return;
@@ -517,6 +522,13 @@
      * 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];
 
@@ -531,6 +543,8 @@
     [anim setFrameRate: 30];
 
     [anim startAnimation];
+    b_window_is_invisible = NO;
+
     /* fullscreenAnimation will be unlocked when animation ends */
 }
 




More information about the vlc-devel mailing list