Move window to top of screen if bottom is obscured

This commit is contained in:
Bjorn Winckler
2008-10-12 14:34:22 +02:00
parent 1957b370bb
commit 0b546f60b1
+9 -1
View File
@@ -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]) {