Remove the view from its super view's list of views that need display when the view is removed from the views hierarchy.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@2588 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Ovidiu Predescu 1997-10-29 22:17:51 +00:00
parent 87966db359
commit 88a15677eb

View file

@ -274,8 +274,13 @@ static NSRecursiveLock *gnustep_gui_nsview_lock = nil;
[self viewWillMoveToWindow:nil];
/* Remove the view from the linked list of views maintained by the super view
so that the view will not receive an unneeded display message. */
[super_view _removeSubviewFromViewsThatNeedDisplay:self];
views = [super_view subviews];
[views removeObjectIdenticalTo:self];
super_view = nil;
}
- (void)replaceSubview:(NSView *)oldView
@ -294,6 +299,10 @@ static NSRecursiveLock *gnustep_gui_nsview_lock = nil;
[oldView setSuperview:nil];
[newView setNextResponder:nil];
/* Remove the view from the linked list of views so that the old view
will not receive an unneeded display message. */
[self _removeSubviewFromViewsThatNeedDisplay:oldView];
[sub_views replaceObjectAtIndex:index withObject:newView];
[newView viewWillMoveToWindow:window];
@ -872,6 +881,23 @@ static NSRecursiveLock *gnustep_gui_nsview_lock = nil;
[super_view _addSubviewForNeedingDisplay:self];
}
- (void)_removeSubviewFromViewsThatNeedDisplay:(NSView*)view
{
/* Remove view from the list of subviews that need display */
if (_subviewsThatNeedDisplay == view)
_subviewsThatNeedDisplay = view->_nextSiblingSubviewThatNeedsDisplay;
else {
NSView* currentView;
for (currentView = _subviewsThatNeedDisplay;
currentView->_nextSiblingSubviewThatNeedsDisplay;
currentView = currentView->_nextSiblingSubviewThatNeedsDisplay)
if (currentView->_nextSiblingSubviewThatNeedsDisplay == view)
currentView->_nextSiblingSubviewThatNeedsDisplay
= view->_nextSiblingSubviewThatNeedsDisplay;
}
}
- (void)setNeedsDisplay:(BOOL)flag
{
needs_display = flag;