From f3cfa66e90f64c428b0ef8df72064ded4dc95413 Mon Sep 17 00:00:00 2001 From: fedor Date: Thu, 10 Oct 2002 03:10:31 +0000 Subject: [PATCH] Constrain windows that are off bottom of screen also. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@14695 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 5 +++++ Source/NSWindow.m | 11 +++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index bcf442200..d13a7e4a2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2002-08-30 Georg Fleischmann + + * Source/NSWindow.m ([-constrainFrameRect]): Move window inside + screen, if window top is below screen. + 2002-10-09 Adam Fedor * Source/NSApplication (hide:): Don't setinputfocus to the diff --git a/Source/NSWindow.m b/Source/NSWindow.m index 76eb92ac3..da7c516d6 100644 --- a/Source/NSWindow.m +++ b/Source/NSWindow.m @@ -1321,7 +1321,7 @@ static NSNotificationCenter *nc = nil; /* Windows need to be constrained when displayed or resized - but only titled windows are constrained. Also, and this is the tricky part, don't constrain if we are merely unhidding the window or if it's - already visible and is just begin reordered. */ + already visible and is just being reordered. */ if ((_styleMask & NSTitledWindowMask) && [NSApp isHidden] == NO && _f.visible == NO) @@ -1517,7 +1517,14 @@ static NSNotificationCenter *nc = nil; { frameRect.origin.y -= difference; } - + else if (NSMaxY (frameRect) < NSMinY (screenRect)) + { + float diff1 = NSMinY (frameRect) - NSMinY (screenRect); + /* move bottom inside the screen, but keep top inside screen */ + frameRect.origin.y -= MAX(difference, diff1); + difference = NSMaxY (frameRect) - NSMaxY (screenRect); + } + /* If the window is resizable, resize it (if needed) so that the bottom edge is on the screen too */ if (_styleMask & NSResizableWindowMask)