From b895c014f2fc5d4cb91069dea7e00b6adcd3edf3 Mon Sep 17 00:00:00 2001 From: Richard Frith-MacDonald Date: Thu, 1 Apr 1999 06:58:28 +0000 Subject: [PATCH] Try to avoid crash when key event goes to text field cell git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4011 72102866-910b-0410-8b05-ffd578937521 --- Source/NSTextField.m | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Source/NSTextField.m b/Source/NSTextField.m index ea5e3ef6c..eb18265ad 100644 --- a/Source/NSTextField.m +++ b/Source/NSTextField.m @@ -395,6 +395,33 @@ fprintf(stderr, " TextField mouseDown --- "); // If not editable then don't recognize the key down if (![self isEditable]) return; + +#if 1 +{ + NSRect cellFrame = bounds; + + if ([cell isBordered]) + { + cellFrame.origin.x += 1; + cellFrame.origin.y += 1; + cellFrame.size.width -= 2; + cellFrame.size.height -= 2; + } + else if ([cell isBezeled]) + { + cellFrame.origin.x += 4; + cellFrame.origin.y += 2; + cellFrame.size.width -= 6; + cellFrame.size.height -= 4; + } + + [cell editWithFrame: cellFrame + inView: self + editor: [window fieldEditor: YES forObject: cell] + delegate: self + event: theEvent]; +} +#else // Hide the cursor during typing [NSCursor hide]; @@ -404,6 +431,7 @@ fprintf(stderr, " TextField mouseDown --- "); [window flushWindow]; [self unlockFocus]; // [self setNeedsDisplay: YES]; +#endif } - (void) keyUp: (NSEvent *)theEvent