From 279a27542cee36223c24eed8ea416aa69989e255 Mon Sep 17 00:00:00 2001 From: Bjorn Winckler Date: Fri, 22 Aug 2008 23:07:23 +0200 Subject: [PATCH] Try to ensure new windows open with bottom edge visible on screen In particular, if new windows are set to open maximized in the vertical direction then the top of newly opened windows will be in line with the top of the frontmost window. --- src/MacVim/MMAppController.m | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/MacVim/MMAppController.m b/src/MacVim/MMAppController.m index 5233e009..b0fb405d 100644 --- a/src/MacVim/MMAppController.m +++ b/src/MacVim/MMAppController.m @@ -755,10 +755,20 @@ fsEventCallback(ConstFSEventStreamRef streamRef, } if (!NSEqualPoints(topLeft, NSZeroPoint)) { + NSPoint oldTopLeft = topLeft; if (topWin) topLeft = [win cascadeTopLeftFromPoint:topLeft]; [win setFrameTopLeftPoint:topLeft]; + + if ([win frame].origin.y < [[win screen] frame].origin.y) { + // Try to avoid shifting the new window downwards if it means that + // the bottom of the window will be off the screen. E.g. if the + // user has set windows to open maximized in the vertical direction + // then the new window will cascade horizontally only. + topLeft.y = oldTopLeft.y; + [win setFrameTopLeftPoint:topLeft]; + } } if (1 == [vimControllers count]) { -- 2.11.4.GIT