From 9aae3ba3ccf22e56f8a741809e5105cdc5c44837 Mon Sep 17 00:00:00 2001 From: Bjorn Winckler Date: Tue, 8 Apr 2008 13:37:21 +0200 Subject: [PATCH] Fix initial window placement bug The algorithm which determines the topmost window only searches through visible windows. The initial window placement bug was a result of this algorithm returning the (invisible) window whose position was to be determined. --- src/MacVim/MMAppController.m | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/MacVim/MMAppController.m b/src/MacVim/MMAppController.m index 2e60e6455f..38a33fda51 100644 --- a/src/MacVim/MMAppController.m +++ b/src/MacVim/MMAppController.m @@ -741,9 +741,10 @@ static int executeInLoginShell(NSString *path, NSArray *args); - (MMVimController *)topmostVimController { - NSArray *windows = [NSApp orderedWindows]; - if ([windows count] > 0) { - NSWindow *window = [windows objectAtIndex:0]; + // Find the topmost visible window which has an associated vim controller. + NSEnumerator *e = [[NSApp orderedWindows] objectEnumerator]; + id window; + while ((window = [e nextObject]) && [window isVisible]) { unsigned i, count = [vimControllers count]; for (i = 0; i < count; ++i) { MMVimController *vc = [vimControllers objectAtIndex:i];