]> git.sesse.net Git - vlc/commitdiff
macosx: Make sure we animate the embedded window in a non blocking way.
authorPierre d'Herbemont <pdherbemont@videolan.org>
Thu, 24 Jul 2008 23:47:31 +0000 (01:47 +0200)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Thu, 24 Jul 2008 23:47:56 +0000 (01:47 +0200)
modules/gui/macosx/embeddedwindow.m

index a4d98e8d7c342421f8e702e1dd8f504059046721..03b2aa0e0751719bd448b4efb10c33446363aa02 100644 (file)
 {
     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