don't alter the key view loop if the window won't auto recalculate a new one

fix setting of _previousKeyView
fix premature display of the insertion pointer
fix occasional persistence of the insertion pointer in a deactivated text view
fix endEditing of text views on drawers
This commit is contained in:
Rolf Jansen 2015-10-08 19:51:18 -03:00 committed by Rolf
parent 68884812bf
commit 302e2abf5e
3 changed files with 33 additions and 29 deletions

View File

@ -374,12 +374,12 @@ NSString * const NSDrawerDidCloseNotification = @"NSDrawerDidCloseNotification";
if ([self state] != NSDrawerOpenState)
return;
[_drawerWindow endEditingFor:nil];
[_parentWindow endEditingFor:nil];
[_parentWindow makeFirstResponder:_parentWindow];
frame = [[self class] drawerFrameWithContentSize:[self contentSize] parentWindow:[self parentWindow] leadingOffset:_leadingOffset trailingOffset:_trailingOffset edge:_edge state:NSDrawerClosedState];
frame.size = [self drawerWindow:_drawerWindow constrainSize:frame.size edge:_edge];
frame.size = [self drawerWindow:_drawerWindow constrainSize:frame.size edge:_edge];
[[NSNotificationCenter defaultCenter] postNotificationName:NSDrawerWillCloseNotification object:self];

View File

@ -2560,8 +2560,10 @@ NSString * const NSOldSelectedCharacterRange=@"NSOldSelectedCharacterRange";
-(BOOL)becomeFirstResponder {
[self updateInsertionPointStateAndRestartTimer:YES];
if([self shouldDrawInsertionPoint])
[self _displayInsertionPointWithState:[[self window] isKeyWindow]];
if(![self needsDisplay] && [self shouldDrawInsertionPoint])
[self _displayInsertionPointWithState:YES];
else
_insertionPointOn = NO;
_firstResponderButNotEditingYet = YES;
_didSendTextDidEndNotification = NO;
@ -2591,7 +2593,7 @@ NSString * const NSOldSelectedCharacterRange=@"NSOldSelectedCharacterRange";
[[[self enclosingScrollView] horizontalRulerView] setClientView:nil];
}
if([self shouldDrawInsertionPoint]){
if(_insertionPointTimer){
[self _displayInsertionPointWithState:NO];
[_insertionPointTimer invalidate];
[_insertionPointTimer release];
@ -2619,7 +2621,7 @@ NSString * const NSOldSelectedCharacterRange=@"NSOldSelectedCharacterRange";
}
-(void)resignKeyWindow {
if([self shouldDrawInsertionPoint]){
if(_insertionPointTimer){
[self _displayInsertionPointWithState:NO];
[_insertionPointTimer invalidate];
[_insertionPointTimer release];
@ -2792,9 +2794,8 @@ NSString * const NSOldSelectedCharacterRange=@"NSOldSelectedCharacterRange";
}while([event type]!=NSLeftMouseUp);
[NSEvent stopPeriodicEvents];
[self setSelectedRange:selection affinity:affinity stillSelecting:NO];
}
-(NSUndoManager *)undoManager {

View File

@ -827,21 +827,24 @@ static inline void buildTransformsIfNeeded(NSView *self) {
}
-(void)_setWindow:(NSWindow *)window {
if(_window!=window)
[self setNextKeyView:nil];
[self viewWillMoveToWindow:window];
_window=window;
[_subviews makeObjectsPerformSelector:_cmd withObject:window];
_validTrackingAreas=NO;
[_window invalidateCursorRectsForView:self]; // this also invalidates tracking areas
if([_window autorecalculatesKeyViewLoop])
[_window recalculateKeyViewLoop];
[self viewDidMoveToWindow];
if (_window != window) {
BOOL windowRecalulatesKeyViewLoop = [window autorecalculatesKeyViewLoop];
if (windowRecalulatesKeyViewLoop)
[self setNextKeyView:nil];
[self viewWillMoveToWindow:window];
_window=window;
[_subviews makeObjectsPerformSelector:_cmd withObject:window];
_validTrackingAreas=NO;
[_window invalidateCursorRectsForView:self]; // this also invalidates tracking areas
if (windowRecalulatesKeyViewLoop)
[_window recalculateKeyViewLoop];
[self viewDidMoveToWindow];
}
}
-(void)_setSuperview:superview {
@ -951,16 +954,16 @@ static inline void buildTransformsIfNeeded(NSView *self) {
}
-(void)_setPreviousKeyView:(NSView *)previous {
_previousKeyView=previous;
_previousKeyView = previous;
}
-(void)setNextKeyView:(NSView *)next {
if(next==nil)
[_nextKeyView _setPreviousKeyView:nil];
if (next)
[next _setPreviousKeyView:self];
else
[_nextKeyView _setPreviousKeyView:self];
[_nextKeyView _setPreviousKeyView:nil];
_nextKeyView=next;
_nextKeyView = next;
}
-(BOOL)acceptsFirstMouse:(NSEvent *)event {