[vlc-devel] commit: macosx: Make sure we animate the embedded window in a non blocking way. (Pierre d' Herbemont )

git version control git at videolan.org
Fri Jul 25 01:45:30 CEST 2008


vlc | branch: master | Pierre d'Herbemont <pdherbemont at videolan.org> | Fri Jul 25 01:47:31 2008 +0200| [8005efa8f987d6786d88f5cf7c31e675f14fef78]

macosx: Make sure we animate the embedded window in a non blocking way.

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

 modules/gui/macosx/embeddedwindow.m |   20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/modules/gui/macosx/embeddedwindow.m b/modules/gui/macosx/embeddedwindow.m
index a4d98e8..03b2aa0 100644
--- a/modules/gui/macosx/embeddedwindow.m
+++ b/modules/gui/macosx/embeddedwindow.m
@@ -601,6 +601,24 @@
 {
     struct args { NSRect frame; BOOL display; BOOL animate; } * args = (struct args*)[packedargs bytes];
 
-    [super setFrame: args->frame display: args->display animate:args->animate];
+    if( args->animate )
+    {
+        /* Make sure we don't block too long and set up a non blocking animation */
+        NSDictionary * dict = [NSDictionary dictionaryWithObjectsAndKeys:
+            self, NSViewAnimationTargetKey,
+            [NSValue valueWithRect:[self frame]], NSViewAnimationStartFrameKey,
+            [NSValue valueWithRect:args->frame], NSViewAnimationEndFrameKey, nil];
+
+        NSViewAnimation * anim = [[NSViewAnimation alloc] initWithViewAnimations:[NSArray arrayWithObjects:dict, nil]];
+
+        [anim setAnimationBlockingMode: NSAnimationNonblocking];
+        [anim setDuration: 0.4];
+        [anim setFrameRate: 30];
+        [anim startAnimation];
+    }
+    else {
+        [super setFrame:args->frame display:args->display animate:args->animate];
+    }
+
 }
 @end




More information about the vlc-devel mailing list