From 8005efa8f987d6786d88f5cf7c31e675f14fef78 Mon Sep 17 00:00:00 2001 From: Pierre d'Herbemont Date: Fri, 25 Jul 2008 01:47:31 +0200 Subject: [PATCH] macosx: Make sure we animate the embedded window in a non blocking way. --- modules/gui/macosx/embeddedwindow.m | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/modules/gui/macosx/embeddedwindow.m b/modules/gui/macosx/embeddedwindow.m index a4d98e8d7c..03b2aa0e07 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 -- 2.39.2