]> git.sesse.net Git - vlc/commitdiff
macosx_dialog_provider: relayout the window less often.
authorPierre d'Herbemont <pdherbemont@free.fr>
Thu, 28 Jan 2010 23:08:35 +0000 (00:08 +0100)
committerPierre d'Herbemont <pdherbemont@free.fr>
Fri, 29 Jan 2010 10:49:24 +0000 (11:49 +0100)
modules/gui/macosx_dialog_provider/dialogProvider.m

index 6c28005dcbac32788e8dc88ba65bbcd0eb906539..33e8b07db4f62c1d40a7435661c38456427c6af6 100644 (file)
@@ -175,6 +175,8 @@ static void destroyProgressPanel (void *);
 
 - (void)recomputeWindowSize
 {
+    [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(recomputeWindowSize) object:nil];
+
     NSWindow *window = [self window];
     NSRect frame = [window frame];
     NSRect contentRect = [window contentRectForFrameRect:frame];
@@ -183,7 +185,6 @@ static void destroyProgressPanel (void *);
     newFrame.origin.y -= newFrame.size.height - frame.size.height;
     newFrame.origin.x -= (newFrame.size.width - frame.size.width) / 2;
     [window setFrame:newFrame display:YES animate:YES];
-
 }
 
 - (NSSize)objectSizeToFit:(NSView *)view
@@ -401,8 +402,11 @@ static void destroyProgressPanel (void *);
 
 
     [self addSubview:view];
-    [self recomputeWindowSize];
     [self relayout];
+
+    // Recompute the size of the window after making sure we won't see anymore update
+    [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(recomputeWindowSize) object:nil];
+    [self performSelector:@selector(recomputeWindowSize) withObject:nil afterDelay:0.1];
 }
 
 - (void)removeSubview:(NSView *)view