Tidied up some inefficient code that was causing window to be checked much

more often that needed.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5344 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 1999-12-01 12:02:09 +00:00
parent fc849e3129
commit f2bcb34b09
4 changed files with 49 additions and 9 deletions

View file

@ -1,4 +1,12 @@
Web Dec 1 8:27:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk> Wen Dec 1 11:55:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/NSWindow.m: Removed spurious setNeedsDisplay when changing
the contentView of a window - it's up to the programmer to do that.
* Source/NSView.m: Removed many spurious setNeedsDisplay calls when
altering the view hierarchy - it's up to the programmer to do a
single call at the end of the work.
Wen Dec 1 8:27:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
Applied and modified/rewrote patch by Jonathan Gapen Applied and modified/rewrote patch by Jonathan Gapen
* Headers/gnustep/gui/NSImage.h: Moved excess BOOL ivar to _flags. * Headers/gnustep/gui/NSImage.h: Moved excess BOOL ivar to _flags.

View file

@ -48,6 +48,16 @@
{ {
[super initDefaults]; [super initDefaults];
[self setExcludedFromWindowsMenu: YES]; [self setExcludedFromWindowsMenu: YES];
[self setAutodisplay: NO];
}
- (void) display
{
}
- (void) displayIfNeeded
{
}
- (void) setViewsNeedDisplay: (BOOL)f
{
} }
@end @end

View file

@ -271,7 +271,6 @@ GSSetDragTypes(NSView* obj, NSArray *types)
[sub_views addObject: aView]; [sub_views addObject: aView];
_rFlags.has_subviews = 1; _rFlags.has_subviews = 1;
[aView resetCursorRects]; [aView resetCursorRects];
[aView setNeedsDisplay: YES];
RELEASE(aView); RELEASE(aView);
} }
@ -310,7 +309,6 @@ GSSetDragTypes(NSView* obj, NSArray *types)
[sub_views insertObject: aView atIndex: index+1]; [sub_views insertObject: aView atIndex: index+1];
_rFlags.has_subviews = 1; _rFlags.has_subviews = 1;
[aView resetCursorRects]; [aView resetCursorRects];
[aView setNeedsDisplay: YES];
RELEASE(aView); RELEASE(aView);
} }
@ -413,7 +411,6 @@ GSSetDragTypes(NSView* obj, NSArray *types)
if ([window firstResponder] == self) if ([window firstResponder] == self)
[window makeFirstResponder: window]; [window makeFirstResponder: window];
[super_view setNeedsDisplayInRect: frame];
RETAIN(self); RETAIN(self);
[super_view->sub_views removeObjectIdenticalTo: self]; [super_view->sub_views removeObjectIdenticalTo: self];
if ([super_view->sub_views count] == 0) if ([super_view->sub_views count] == 0)
@ -448,7 +445,6 @@ GSSetDragTypes(NSView* obj, NSArray *types)
[sub_views addObject: newView]; [sub_views addObject: newView];
_rFlags.has_subviews = 1; _rFlags.has_subviews = 1;
[newView resetCursorRects]; [newView resetCursorRects];
[newView setNeedsDisplay: YES];
RELEASE(newView); RELEASE(newView);
} }
else if ([sub_views indexOfObjectIdenticalTo: oldView] != NSNotFound) else if ([sub_views indexOfObjectIdenticalTo: oldView] != NSNotFound)
@ -482,7 +478,6 @@ GSSetDragTypes(NSView* obj, NSArray *types)
[sub_views addObject: newView]; [sub_views addObject: newView];
_rFlags.has_subviews = 1; _rFlags.has_subviews = 1;
[newView resetCursorRects]; [newView resetCursorRects];
[newView setNeedsDisplay: YES];
RELEASE(newView); RELEASE(newView);
} }
} }

View file

@ -373,7 +373,6 @@ static NSMapTable* windowmaps = NULL;
[[wv subviews] count]); [[wv subviews] count]);
[content_view setNextResponder: self]; [content_view setNextResponder: self];
[content_view setNeedsDisplay: YES]; // Make sure we redraw.
} }
/* /*
@ -682,6 +681,16 @@ static NSMapTable* windowmaps = NULL;
unsigned i; unsigned i;
NSWindow *w; NSWindow *w;
if (_rFlags.needs_display == YES)
{
/*
* Don't keep trying to update the window while it is ordered out
*/
[[NSRunLoop currentRunLoop]
cancelPerformSelector: @selector(_handleWindowNeedsDisplay:)
target: self
argument: nil];
}
if ([self isKeyWindow]) if ([self isKeyWindow])
{ {
[self resignKeyWindow]; [self resignKeyWindow];
@ -743,7 +752,25 @@ static NSMapTable* windowmaps = NULL;
} }
} }
} }
else
{
if (_rFlags.needs_display == NO)
{
/*
* Once we are ordered back in, we will want to update the window
* whenever there is anything to do.
*/
[[NSRunLoop currentRunLoop]
performSelector: @selector(_handleWindowNeedsDisplay:)
target: self
argument: nil
order: 600000
modes: [NSArray arrayWithObjects:
NSDefaultRunLoopMode,
NSModalPanelRunLoopMode,
NSEventTrackingRunLoopMode, nil]];
}
}
DPSorderwindow(GSCurrentContext(), place, otherWin, [self windowNumber]); DPSorderwindow(GSCurrentContext(), place, otherWin, [self windowNumber]);
} }
@ -1108,7 +1135,7 @@ static NSMapTable* windowmaps = NULL;
- (void) _handleWindowNeedsDisplay: (id)bogus - (void) _handleWindowNeedsDisplay: (id)bogus
{ {
[self displayIfNeeded]; [self displayIfNeeded];
} }
- (void) setViewsNeedDisplay: (BOOL)flag - (void) setViewsNeedDisplay: (BOOL)flag