From c348720e77aa450f722884a2d0b4f66ef42aa0b0 Mon Sep 17 00:00:00 2001 From: Bjorn Winckler Date: Sun, 12 Oct 2008 14:34:22 +0200 Subject: [PATCH] Move window to top of screen if bottom is obscured --- src/MacVim/MMAppController.m | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/MacVim/MMAppController.m b/src/MacVim/MMAppController.m index 6f15abaf..3d7fa845 100644 --- a/src/MacVim/MMAppController.m +++ b/src/MacVim/MMAppController.m @@ -642,7 +642,8 @@ fsEventCallback(ConstFSEventStreamRef streamRef, [win setFrameTopLeftPoint:topLeft]; - if ([win frame].origin.y < [[win screen] frame].origin.y) { + NSPoint screenOrigin = [[win screen] frame].origin; + if ([win frame].origin.y < screenOrigin.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 @@ -650,6 +651,13 @@ fsEventCallback(ConstFSEventStreamRef streamRef, topLeft.y = oldTopLeft.y; [win setFrameTopLeftPoint:topLeft]; } + + if ([win frame].origin.y < screenOrigin.y) { + // Move the window to the top of the screen if the bottom of the + // window is still obscured. + topLeft.y = NSMaxY([[win screen] frame]); + [win setFrameTopLeftPoint:topLeft]; + } } if (1 == [vimControllers count]) { -- 2.11.4.GIT