Fixes from n.pero

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4989 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 1999-10-12 12:59:10 +00:00
parent 9196accea4
commit adba2520a6
4 changed files with 43 additions and 9 deletions

View file

@ -1,3 +1,11 @@
Sat Oct 9 1999 Nicola Pero <n.pero@mi.flashnet.it>
* Source/NSButton.m ([-keyDown:]): Perform a click if
the key is SPACE or ENTER.
* Source/NSCell.m ([-performClick:]): Completely rewritten.
* Source/NSView.m ([-previousValidKeyView]),
([-nextValidKeyView]): fix to avoid an infinite loop.
1999-10-09 <fedor@gnu.org>
* Model/GMAppKit.m ([NSPopUpButton -initWithModelUnarchiver:]):

View file

@ -294,8 +294,24 @@ id _nsbuttonCellClass = nil;
- (void) keyDown: (NSEvent*)theEvent
{
if ([self performKeyEquivalent: theEvent] == NO)
[super keyDown: theEvent];
if ([self isEnabled])
{
NSString *keyDescription = [theEvent charactersIgnoringModifiers];
// Handle SPACE or RETURN to perform a click
if (([keyDescription compare: @" "] == NSOrderedSame)
|| ([theEvent keyCode] == 0x0d))
{
[self performClick: self];
return;
}
// TODO: Understand better, I don't think this should be here.
if ([self performKeyEquivalent: theEvent] == YES)
return;
}
[super keyDown: theEvent];
}
//

View file

@ -825,15 +825,26 @@ static Class cellClass;
- (void) performClick: (id)sender
{
NSView *cv;
NSRect cvBounds;
NSWindow *cvWin;
if (control_view)
cv = control_view;
else
cv = [NSView focusView];
NSLog(@"performClick:");
cvBounds = [cv bounds];
cvWin = [cv window];
[self highlight: YES withFrame: cvBounds inView: cv];
[cvWin flushWindow];
// Wait approx 1/5 seconds
[[NSRunLoop currentRunLoop]
runUntilDate: [NSDate dateWithTimeIntervalSinceNow: 0.2]];
[self highlight: NO withFrame: cvBounds inView: cv];
[cvWin flushWindow];
[self highlight: YES withFrame: [cv frame] inView: cv];
if ([self action])
{
NS_DURING
@ -842,14 +853,11 @@ static Class cellClass;
}
NS_HANDLER
{
[self highlight: NO withFrame: [cv frame] inView: cv];
[localException raise];
}
NS_ENDHANDLER
}
[self highlight: NO withFrame: [cv frame] inView: cv];
}
/*
* Assigning a Tag
*/

View file

@ -2090,7 +2090,8 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
theView = _nextKeyView;
while (1)
{
if ([theView acceptsFirstResponder] || (theView == nil))
if ([theView acceptsFirstResponder] || (theView == nil)
|| (theView == self))
return theView;
theView = [theView nextKeyView];
@ -2122,7 +2123,8 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
theView = _previousKeyView;
while (1)
{
if ([theView acceptsFirstResponder] || (theView == nil))
if ([theView acceptsFirstResponder] || (theView == nil)
|| (theView == self))
return theView;
theView = [theView previousKeyView];