Make -setBackgroundColor: redisplay the window background. Fix frame constraining.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@19785 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Alexander Malmberg 2004-07-28 17:56:57 +00:00
parent 6576a77429
commit 8335596ee3
4 changed files with 47 additions and 22 deletions

View file

@ -1,3 +1,18 @@
2004-07-28 19:52 Alexander Malmberg <alexander@malmberg.org>
* Source/GSWindowDecorationView.h, Source/GSWindowDecorationView.m
(-setBackgroundColor:): New method.
* Source/NSWindow.m (-setBackgroundColor:): Pass the call along to
_wv.
(-orderWindow:relativeTo:): Use -setFrame:display: to change the
frame after contstraining it.
(-constrainFrameRect:toScreen:): Fix the check of whether the bottom
of the window is off the screen.
(-_sendEvent:becomesKeyOnlyIfNeeded:): Clean up handling of
GSAppKitWindowResized.
(-initWithCoder:): Destroy _miniaturizedImage before setting it to
the decoded image.
2004-07-27 Quentin Mathe <qmathe@club-internet.fr> 2004-07-27 Quentin Mathe <qmathe@club-internet.fr>
* Headers/Additions/GNUstepGUI/GSToolbarView.h: * Headers/Additions/GNUstepGUI/GSToolbarView.h:

View file

@ -75,6 +75,7 @@ windowNumber will be 0.
-(void) setTitle: (NSString *)title; -(void) setTitle: (NSString *)title;
-(void) setInputState: (int)state; -(void) setInputState: (int)state;
-(void) setDocumentEdited: (BOOL)flag; -(void) setDocumentEdited: (BOOL)flag;
-(void) setBackgroundColor: (NSColor *)color;
@end @end

View file

@ -223,6 +223,11 @@ Returns the content rect for a given window frame.
[GSServerForWindow(window) docedited: documentEdited : windowNumber]; [GSServerForWindow(window) docedited: documentEdited : windowNumber];
} }
-(void) setBackgroundColor: (NSColor *)color
{
[self setNeedsDisplayInRect: contentRect];
}
- (BOOL) isOpaque - (BOOL) isOpaque
{ {

View file

@ -1012,6 +1012,7 @@ many times.
- (void) setBackgroundColor: (NSColor*)color - (void) setBackgroundColor: (NSColor*)color
{ {
ASSIGN(_backgroundColor, color); ASSIGN(_backgroundColor, color);
[_wv setBackgroundColor: color];
} }
- (void) setRepresentedFilename: (NSString*)aString - (void) setRepresentedFilename: (NSString*)aString
@ -1493,10 +1494,7 @@ many times.
{ {
NSRect nframe = [self constrainFrameRect: _frame NSRect nframe = [self constrainFrameRect: _frame
toScreen: [self screen]]; toScreen: [self screen]];
if (_windowNum) [self setFrame: nframe display: NO];
[self setFrame: nframe display: NO];
else
_frame = nframe;
} }
// create deferred window // create deferred window
if (_windowNum == 0) if (_windowNum == 0)
@ -1696,7 +1694,7 @@ many times.
{ {
frameRect.origin.y -= difference; frameRect.origin.y -= difference;
} }
else if (NSMaxY (frameRect) < NSMinY (screenRect)) else if (NSMinY (frameRect) < NSMinY (screenRect))
{ {
float diff1 = NSMinY (frameRect) - NSMinY (screenRect); float diff1 = NSMinY (frameRect) - NSMinY (screenRect);
/* move bottom inside the screen, but keep top inside screen */ /* move bottom inside the screen, but keep top inside screen */
@ -3116,26 +3114,30 @@ resetCursorRectsForView(NSView *theView)
break; break;
case GSAppKitWindowResized: case GSAppKitWindowResized:
_frame.size.width = (float)[theEvent data1];
_frame.size.height = (float)[theEvent data2];
/* Resize events always move the frame origin. The new origin
is stored in the event location field */
_frame.origin = [theEvent locationInWindow];
if (_autosaveName != nil)
{
[self saveFrameUsingName: _autosaveName];
}
{ {
NSRect rect = _frame; NSRect newFrame;
rect.origin = NSZeroPoint; newFrame.size.width = [theEvent data1];
[_wv setFrame: rect]; newFrame.size.height = [theEvent data2];
/* Resize events always move the frame origin. The new origin
is stored in the event location field. */
newFrame.origin = [theEvent locationInWindow];
_frame = newFrame;
newFrame.origin = NSZeroPoint;
[_wv setFrame: newFrame];
[_wv setNeedsDisplay: YES]; [_wv setNeedsDisplay: YES];
if (_autosaveName != nil)
{
[self saveFrameUsingName: _autosaveName];
}
[self _processResizeEvent];
[nc postNotificationName: NSWindowDidResizeNotification
object: self];
break;
} }
[self _processResizeEvent];
[nc postNotificationName: NSWindowDidResizeNotification
object: self];
break;
case GSAppKitWindowClose: case GSAppKitWindowClose:
[self performClose: NSApp]; [self performClose: NSApp];
@ -4078,6 +4080,8 @@ resetCursorRectsForView(NSView *theView)
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag]; [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
[self setAcceptsMouseMovedEvents: flag]; [self setAcceptsMouseMovedEvents: flag];
/* _miniaturizedImage has already been set by -_initDefaults. */
DESTROY(_miniaturizedImage);
[aDecoder decodeValueOfObjCType: @encode(id) [aDecoder decodeValueOfObjCType: @encode(id)
at: &_miniaturizedImage]; at: &_miniaturizedImage];
[aDecoder decodeValueOfObjCType: @encode(id) [aDecoder decodeValueOfObjCType: @encode(id)