Propery constrain window frames

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@12073 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2002-01-09 20:41:07 +00:00
parent 2a7737282e
commit 65de9f1abd
4 changed files with 46 additions and 7 deletions

View file

@ -1,3 +1,16 @@
2002-01-09 Adam Fedor <fedor@gnu.org>
* Source/NSApplication.m (_NSAppKitUncaughtExceptionHandler):
Use non-graphical handler when it is a WindowServer exception.
* Source/NSWindow.m (-orderWindow:relativeTo:): Constrain only
titled windows and only when not already visible.
* Source/NSWindow.m (-constrainFrameRect:toScreen:): Don't constrain
height less than minimum size.
(setFrame:display:): constrain frame on a resize.
* TextConverters/RTF/GNUmakefile.preamble: Look for library in Source.
Wed Jan 9 12:07:58 2002 Nicola Pero <n.pero@mi.flashnet.it>
* configure.in: Abort with an error if GNUSTEP_SYSTEM_ROOT is not

View file

@ -50,6 +50,7 @@
# include <Foundation/NSConnection.h>
#endif
#include <AppKit/AppKitExceptions.h>
#include <AppKit/NSGraphicsContext.h>
#include <AppKit/NSApplication.h>
#include <AppKit/NSDocumentController.h>
@ -97,9 +98,11 @@ _NSAppKitUncaughtExceptionHandler (NSException *exception)
NSSetUncaughtExceptionHandler (defaultUncaughtExceptionHandler);
/*
* If there is no graphics context to run the alert panel in, just
* quit. */
if (GSCurrentContext() == nil)
* If there is no graphics context to run the alert panel in or
* its a sever error, use a non-graphical exception handler
*/
if (GSCurrentContext() == nil
|| [[exception name] isEqual: NSWindowServerCommunicationException])
{
/* The following will raise again the exception using the base
library exception handler */

View file

@ -647,6 +647,7 @@ static NSNotificationCenter *nc = nil;
}
frame = [NSWindow contentRectForFrameRect: frame styleMask: _styleMask];
DPSwindow(context, NSMinX(frame), NSMinY(frame),
NSWidth(frame), NSHeight(frame),
_backingType, &_windowNum);
@ -1272,15 +1273,27 @@ static NSNotificationCenter *nc = nil;
}
else
{
NSRect nframe = [self constrainFrameRect:_frame toScreen:[self screen]];
/* 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. */
if ((_styleMask & NSTitledWindowMask)
&& [NSApp isHidden] == NO
&& _f.visible == NO)
{
NSRect nframe = [self constrainFrameRect: _frame
toScreen: [self screen]];
if (_windowNum)
[self setFrame: nframe display: NO];
else
_frame = nframe;
}
// create deferred window
if (_windowNum == 0)
{
[self _initBackendWindow: _frame];
display = YES;
}
else if (NSEqualRects(_frame, nframe) == NO)
[self setFrame: nframe display: NO];
}
DPSorderwindow(context, place, otherWin, _windowNum);
if (display)
@ -1465,6 +1478,8 @@ static NSNotificationCenter *nc = nil;
{
frameRect.size.height -= difference;
}
if (frameRect.size.height < _minimumSize.height)
frameRect.size.height = _minimumSize.height;
}
return frameRect;
@ -1516,6 +1531,14 @@ static NSNotificationCenter *nc = nil;
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

View file

@ -54,7 +54,7 @@ ADDITIONAL_INCLUDE_DIRS +=-I../../Headers
#ADDITIONAL_LDFLAGS +=
# Additional library directories the linker should search
#ADDITIONAL_LIB_DIRS +=
ADDITIONAL_LIB_DIRS += -L../Source/$(GNUSTEP_OBJ_DIR)
#ADDITIONAL_TOOL_LIBS +=