Handle case when makeFirstResonder: fails.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@25456 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fredkiefer 2007-09-05 13:04:49 +00:00
parent 9a371e74bd
commit 136c7c950c
2 changed files with 69 additions and 22 deletions

View file

@ -1,3 +1,31 @@
2007-09-06 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSWindow.m (-sendEvent:, -selectKeyViewFollowingView:,
-selectKeyViewPrecedingView:, -selectNextKeyView:,
-selectPreviousKeyView:): Handle case when makeFirstResonder:
fails.
2007-09-05 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSLayoutManager.m
(-glyphIndexForPoint:...fractionOfDistanceThroughGlyph:): Don't
ignore invisible glyphs.
* Source/NSTextView.m (-_characterIndexForPoint:respectFraction:):
New helper method.
* Source/NSTextView.m (-characterIndexForPoint:): Correct to use
screen coordinates.
* Source/NSTextView.m (-draggingEntered:, -draggingUpdated:,
-mouseDown:): Use new helper method.
* Source/NSAlert.m (-_setupPanel): Check count of buttons.
* Source/NSDocument.m (-setFileName:, -setFileURL:): Set url and
file name always together.
* Source/NSDocument.m (-dataOfType:error:,
-fileWrapperOfType:error:, -readFromFileWrapper:ofType:error:,
-readFromURL:ofType:error:, -writeSafelyToURL:...error:,
-writeToURL:ofType:error:, -writeToURL:...error:,
-printOperationWithSettings:error:): Set error to nil.
Patches by Wolfgang Lux <wolfgang.lux@gmail.com>.
2007-09-04 Fred Kiefer <FredKiefer@gmx.de> 2007-09-04 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSActionCell.m (-objectValue, -attributedStringValue): * Source/NSActionCell.m (-objectValue, -attributedStringValue):
@ -412,7 +440,6 @@
* Source/NSBitmapImageRep+GIF.m : removed some C99-isms * Source/NSBitmapImageRep+GIF.m : removed some C99-isms
* Source/NSDocument.m : removed some C99-isms * Source/NSDocument.m : removed some C99-isms
2007-05-10 Richard Frith-Macdonald <rfm@gnu.org> 2007-05-10 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSAnimation.m: removed some C99-isms and simplified by * Source/NSAnimation.m: removed some C99-isms and simplified by

View file

@ -2803,7 +2803,9 @@ resetCursorRectsForView(NSView *theView)
return NO; return NO;
if (![aResponder acceptsFirstResponder]) if (![aResponder acceptsFirstResponder])
return NO; {
return NO;
}
} }
/* So that the implementation of -resignFirstResponder in /* So that the implementation of -resignFirstResponder in
@ -2816,12 +2818,14 @@ resetCursorRectsForView(NSView *theView)
* Change only if it replies YES. * Change only if it replies YES.
*/ */
if ((_firstResponder) && (![_firstResponder resignFirstResponder])) if ((_firstResponder) && (![_firstResponder resignFirstResponder]))
return NO; {
return NO;
}
_firstResponder = aResponder; _firstResponder = aResponder;
if ((aResponder == nil) || ![_firstResponder becomeFirstResponder]) if ((aResponder == nil) || ![_firstResponder becomeFirstResponder])
{ {
_firstResponder = self; _firstResponder = self;
[_firstResponder becomeFirstResponder]; [_firstResponder becomeFirstResponder];
return (aResponder == nil); return (aResponder == nil);
} }
@ -3274,14 +3278,18 @@ resetCursorRectsForView(NSView *theView)
{ {
v = [_wv hitTest: [theEvent locationInWindow]]; v = [_wv hitTest: [theEvent locationInWindow]];
} }
if (_firstResponder != v)
{
[self makeFirstResponder: v];
}
if (_lastView) if (_lastView)
{ {
DESTROY(_lastView); DESTROY(_lastView);
} }
if (_firstResponder != v)
{
// Only try to set first responder, when the view wants it.
if ([v acceptsFirstResponder] && ![self makeFirstResponder: v])
{
return;
}
}
if (wasKey == YES || [v acceptsFirstMouse: theEvent] == YES) if (wasKey == YES || [v acceptsFirstMouse: theEvent] == YES)
{ {
if ([NSHelpManager isContextHelpModeActive]) if ([NSHelpManager isContextHelpModeActive])
@ -3843,12 +3851,15 @@ resetCursorRectsForView(NSView *theView)
theView = [aView nextValidKeyView]; theView = [aView nextValidKeyView];
if (theView) if (theView)
{ {
[self makeFirstResponder: theView]; if (![self makeFirstResponder: theView])
{
return;
}
if ([theView respondsToSelector:@selector(selectText:)]) if ([theView respondsToSelector:@selector(selectText:)])
{ {
_selectionDirection = NSSelectingNext; _selectionDirection = NSSelectingNext;
[(id)theView selectText: self]; [(id)theView selectText: self];
_selectionDirection = NSDirectSelection; _selectionDirection = NSDirectSelection;
} }
} }
} }
@ -3864,13 +3875,16 @@ resetCursorRectsForView(NSView *theView)
theView = [aView previousValidKeyView]; theView = [aView previousValidKeyView];
if (theView) if (theView)
{ {
[self makeFirstResponder: theView]; if (![self makeFirstResponder: theView])
{
return;
}
if ([theView respondsToSelector:@selector(selectText:)]) if ([theView respondsToSelector:@selector(selectText:)])
{ {
_selectionDirection = NSSelectingPrevious; _selectionDirection = NSSelectingPrevious;
[(id)theView selectText: self]; [(id)theView selectText: self];
_selectionDirection = NSDirectSelection; _selectionDirection = NSDirectSelection;
} }
} }
} }
@ -3900,7 +3914,10 @@ resetCursorRectsForView(NSView *theView)
if (theView) if (theView)
{ {
[self makeFirstResponder: theView]; if (![self makeFirstResponder: theView])
{
return;
}
if ([theView respondsToSelector:@selector(selectText:)]) if ([theView respondsToSelector:@selector(selectText:)])
{ {
_selectionDirection = NSSelectingNext; _selectionDirection = NSSelectingNext;
@ -3936,8 +3953,11 @@ resetCursorRectsForView(NSView *theView)
if (theView) if (theView)
{ {
[self makeFirstResponder: theView]; if (![self makeFirstResponder: theView])
if ([theView respondsToSelector:@selector(selectText:)]) {
return;
}
if ([theView respondsToSelector:@selector(selectText:)])
{ {
_selectionDirection = NSSelectingPrevious; _selectionDirection = NSSelectingPrevious;
[(id)theView selectText: self]; [(id)theView selectText: self];