Commit b98058c9 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

macosx_dialog_provider: relayout the window less often.

parent d7413881
...@@ -175,6 +175,8 @@ static void destroyProgressPanel (void *); ...@@ -175,6 +175,8 @@ static void destroyProgressPanel (void *);
- (void)recomputeWindowSize - (void)recomputeWindowSize
{ {
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(recomputeWindowSize) object:nil];
NSWindow *window = [self window]; NSWindow *window = [self window];
NSRect frame = [window frame]; NSRect frame = [window frame];
NSRect contentRect = [window contentRectForFrameRect:frame]; NSRect contentRect = [window contentRectForFrameRect:frame];
...@@ -183,7 +185,6 @@ static void destroyProgressPanel (void *); ...@@ -183,7 +185,6 @@ static void destroyProgressPanel (void *);
newFrame.origin.y -= newFrame.size.height - frame.size.height; newFrame.origin.y -= newFrame.size.height - frame.size.height;
newFrame.origin.x -= (newFrame.size.width - frame.size.width) / 2; newFrame.origin.x -= (newFrame.size.width - frame.size.width) / 2;
[window setFrame:newFrame display:YES animate:YES]; [window setFrame:newFrame display:YES animate:YES];
} }
- (NSSize)objectSizeToFit:(NSView *)view - (NSSize)objectSizeToFit:(NSView *)view
...@@ -401,8 +402,11 @@ static void destroyProgressPanel (void *); ...@@ -401,8 +402,11 @@ static void destroyProgressPanel (void *);
[self addSubview:view]; [self addSubview:view];
[self recomputeWindowSize];
[self relayout]; [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 - (void)removeSubview:(NSView *)view
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment