Permalink
Browse files

Only cascade from windows belonging to Vim process

This ensures that a newly opened window isn't cascaded from e.g. the
preferences panel.
  • Loading branch information...
1 parent 296634f commit 6e8e20588db8ec20629e4d04eafb20dab8df8d3b @b4winckler b4winckler committed Apr 6, 2008
Showing with 6 additions and 6 deletions.
  1. +6 −6 src/MacVim/MMAppController.m
@@ -469,15 +469,15 @@ - (void)removeVimController:(id)controller
- (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 @@ - (void)windowControllerWillOpen:(MMWindowController *)windowController
}
if (!NSEqualPoints(topLeft, NSZeroPoint)) {
- if (keyWin)
+ if (topWin)
topLeft = [win cascadeTopLeftFromPoint:topLeft];
[win setFrameTopLeftPoint:topLeft];

0 comments on commit 6e8e205

Please sign in to comment.