From 15aab01ceb342ca5016e1c7575a6a6bd5d2fc8a0 Mon Sep 17 00:00:00 2001 From: Richard Frith-Macdonald Date: Sat, 26 Apr 2003 06:39:49 +0000 Subject: [PATCH] Try to compensate for changes in screen size. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@16545 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 5 +++++ Source/NSWindow.m | 25 +++++++++++++++++++++---- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index c4f395608..cb6c0a21f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-04-26 Richard Frith-Macdonald + + * Source/NSWindow.m: ([setFrameFromString:]) try to adjust sensibly + for changes to screen size. + 2003-04-26 Fred Kiefer * Source/NSPanel.m diff --git a/Source/NSWindow.m b/Source/NSWindow.m index 24d2cf735..0bcda2a8c 100644 --- a/Source/NSWindow.m +++ b/Source/NSWindow.m @@ -3625,12 +3625,29 @@ Code shared with [NSPanel -sendEvent:], remember to update both places. nRect = [[self screen] visibleFrame]; /* - * FIXME - if the stored screen area is not the same as that currently - * available, we should probably adjust the window frame (position) in - * some way to try to make layout sensible. + * If the new screen drawable area has moved relative to the one in + * which the window was saved, adjust the window position accordingly. */ - if (NSEqualRects(nRect, sRect) == NO) + if (NSEqualPoints(nRect.origin, sRect.origin) == NO) { + fRect.origin.x += nRect.origin.x - sRect.origin.x; + fRect.origin.y += nRect.origin.y - sRect.origin.y; + } + + /* + * If the stored screen area is not the same as that currently + * available, we adjust the window frame (position) to try to + * make layout sensible. + */ + if (nRect.size.width != sRect.size.width) + { + fRect.origin.x = nRect.origin.x + (fRect.origin.x - nRect.origin.x) + * (nRect.size.width / sRect.size.width); + } + if (nRect.size.height != sRect.size.height) + { + fRect.origin.y = nRect.origin.y + (fRect.origin.y - nRect.origin.y) + * (nRect.size.height / sRect.size.height); } /*