From fdcce91bf2a648e6339abd2c37998d61a6a034e4 Mon Sep 17 00:00:00 2001 From: Bjorn Winckler Date: Sun, 6 Apr 2008 14:36:12 +0200 Subject: [PATCH] Only cascade from windows belonging to Vim process This ensures that a newly opened window isn't cascaded from e.g. the preferences panel. --- src/MacVim/MMAppController.m | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/MacVim/MMAppController.m b/src/MacVim/MMAppController.m index 1e202afe..2e60e645 100644 --- a/src/MacVim/MMAppController.m +++ b/src/MacVim/MMAppController.m @@ -469,15 +469,15 @@ static int executeInLoginShell(NSString *path, NSArray *args); - (void)windowControllerWillOpen:(MMWindowController *)windowController { NSPoint topLeft = NSZeroPoint; - NSWindow *keyWin = [NSApp keyWindow]; + NSWindow *topWin = [[[self topmostVimController] windowController] window]; NSWindow *win = [windowController window]; if (!win) return; - // If there is a key window, cascade from it, otherwise use the autosaved - // window position (if any). - if (keyWin) { - NSRect frame = [keyWin frame]; + // If there is a window belonging to a Vim process, cascade from it, + // otherwise use the autosaved window position (if any). + if (topWin) { + NSRect frame = [topWin frame]; topLeft = NSMakePoint(frame.origin.x, NSMaxY(frame)); } else { NSString *topLeftString = [[NSUserDefaults standardUserDefaults] @@ -487,7 +487,7 @@ static int executeInLoginShell(NSString *path, NSArray *args); } if (!NSEqualPoints(topLeft, NSZeroPoint)) { - if (keyWin) + if (topWin) topLeft = [win cascadeTopLeftFromPoint:topLeft]; [win setFrameTopLeftPoint:topLeft]; -- 2.11.4.GIT