[vlc-devel] commit: macosx_dialog_provider: relayout the window less often. (Pierre d' Herbemont )
git version control
git at videolan.org
Fri Jan 29 11:49:33 CET 2010
vlc | branch: master | Pierre d'Herbemont <pdherbemont at free.fr> | Fri Jan 29 00:08:35 2010 +0100| [b98058c9747f812274748ed87f406270afbee2c6] | committer: Pierre d'Herbemont
macosx_dialog_provider: relayout the window less often.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b98058c9747f812274748ed87f406270afbee2c6
---
.../gui/macosx_dialog_provider/dialogProvider.m | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/modules/gui/macosx_dialog_provider/dialogProvider.m b/modules/gui/macosx_dialog_provider/dialogProvider.m
index 6c28005..33e8b07 100644
--- a/modules/gui/macosx_dialog_provider/dialogProvider.m
+++ b/modules/gui/macosx_dialog_provider/dialogProvider.m
@@ -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
More information about the vlc-devel
mailing list