mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 05:10:38 +00:00
Improved the NSWindow positioning
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@20306 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
e739e88641
commit
a93430ad56
2 changed files with 42 additions and 32 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2004-11-07 Quentin Mathe <qmathe@club-internet.fr>
|
||||
|
||||
* Source/NSWindow.m (-constrainFrameRect:toScreen:): Modified the method
|
||||
to match the specification and the constraints used when the user
|
||||
moves/resizes the window with the cursor. That makes possible to have
|
||||
resizable windows which extends below the bottom of the screen as long
|
||||
as you can move them up to take back the resize control on the screen.
|
||||
(-setFrame:display:): Modified the method to remove the possibility to
|
||||
have the window title bar positioned over the top of the screen when
|
||||
using -gui window decorations.
|
||||
|
||||
2004-11-06 08:34 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/GSNibTemplates.m: Removed nibInstantiate. This method
|
||||
|
|
|
@ -1709,36 +1709,36 @@ many times.
|
|||
|
||||
/* Move top edge of the window inside the screen */
|
||||
difference = NSMaxY (frameRect) - NSMaxY (screenRect);
|
||||
|
||||
if (difference > 0)
|
||||
{
|
||||
frameRect.origin.y -= difference;
|
||||
}
|
||||
else if (NSMinY (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 */
|
||||
bottom edge is on the screen or can be on the screen when the user moves
|
||||
the window */
|
||||
difference = NSMaxY (screenRect) - NSMaxY (frameRect);
|
||||
if (_styleMask & NSResizableWindowMask)
|
||||
{
|
||||
difference = screenRect.origin.y - frameRect.origin.y;
|
||||
if (difference > 0)
|
||||
{
|
||||
frameRect.size.height -= difference;
|
||||
frameRect.origin.y += difference;
|
||||
}
|
||||
/* Ensure that rewsizing doesn't makewindow smaller than minimum */
|
||||
difference = _minimumSize.height - frameRect.size.height;
|
||||
if (difference > 0)
|
||||
{
|
||||
frameRect.size.height += difference;
|
||||
frameRect.origin.y -= difference;
|
||||
}
|
||||
float difference2;
|
||||
|
||||
difference2 = screenRect.origin.y - frameRect.origin.y;
|
||||
difference2 -= difference;
|
||||
// Take in account the space between the top of window and the top of the
|
||||
// screen which can be used to move the bottom of the window on the screen
|
||||
if (difference2 > 0)
|
||||
{
|
||||
frameRect.size.height -= difference2;
|
||||
frameRect.origin.y += difference2;
|
||||
}
|
||||
|
||||
/* Ensure that resizing doesn't makewindow smaller than minimum */
|
||||
difference2 = _minimumSize.height - frameRect.size.height;
|
||||
if (difference2 > 0)
|
||||
{
|
||||
frameRect.size.height += difference2;
|
||||
frameRect.origin.y -= difference2;
|
||||
}
|
||||
}
|
||||
|
||||
return frameRect;
|
||||
|
@ -1787,17 +1787,16 @@ many times.
|
|||
{
|
||||
frameRect.size.height = _minimumSize.height;
|
||||
}
|
||||
|
||||
|
||||
/* Windows need to be constrained when displayed or resized - but only
|
||||
titled windows are constrained */
|
||||
if (_styleMask & NSTitledWindowMask)
|
||||
{
|
||||
frameRect = [self constrainFrameRect: frameRect toScreen: [self screen]];
|
||||
}
|
||||
|
||||
if (NSEqualSizes(frameRect.size, _frame.size) == NO)
|
||||
{
|
||||
/* Windows need to be constrained when displayed or resized - but only
|
||||
titled windows are constrained */
|
||||
if (_styleMask & NSTitledWindowMask)
|
||||
{
|
||||
frameRect = [self constrainFrameRect: frameRect
|
||||
toScreen: [self screen]];
|
||||
}
|
||||
|
||||
if ([_delegate respondsToSelector: @selector(windowWillResize:toSize:)])
|
||||
{
|
||||
frameRect.size = [_delegate windowWillResize: self
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue