Better process of keyboard events and first responder.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5002 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
nico 1999-10-13 00:51:46 +00:00
parent 8d33036d93
commit 23aa70bb55

View file

@ -811,7 +811,7 @@ static NSRecursiveLock *windowsLock;
- (void) display - (void) display
{ {
needs_display = NO; needs_display = NO;
if (!first_responder) if ((!first_responder) || (first_responder == self))
if (_initial_first_responder) if (_initial_first_responder)
[self makeFirstResponder: _initial_first_responder]; [self makeFirstResponder: _initial_first_responder];
/* /*
@ -1245,14 +1245,6 @@ static NSRecursiveLock *windowsLock;
{ {
unsigned int key_code = [theEvent keyCode]; unsigned int key_code = [theEvent keyCode];
// TODO:
// "A mnemonic matching the character(s) typed,
// not requiring the Alternate key to be pressed"
// TODO:
// "A key equivalent, not requiring the Command (or Control) key
// to be pressed"
// If this is a TAB or TAB+SHIFT event, move to the next key view // If this is a TAB or TAB+SHIFT event, move to the next key view
if (key_code == 0x09) if (key_code == 0x09)
{ {
@ -1274,6 +1266,26 @@ static NSRecursiveLock *windowsLock;
} }
return; return;
} }
// Try to process the event as a key equivalent
// without Control having being pressed
{
NSEvent *new_event
= [NSEvent keyEventWithType: [theEvent type]
location: NSZeroPoint
modifierFlags: ([theEvent modifierFlags] | NSControlKeyMask)
timestamp: [theEvent timestamp]
windowNumber: [theEvent windowNumber]
context: [theEvent context]
characters: [theEvent characters]
charactersIgnoringModifiers: [theEvent
charactersIgnoringModifiers]
isARepeat: [theEvent isARepeat]
keyCode: key_code];
if ([self performKeyEquivalent: new_event])
return;
}
// Otherwise, pass the event up // Otherwise, pass the event up
[super keyDown: theEvent]; [super keyDown: theEvent];
} }
@ -2321,7 +2333,7 @@ static NSRecursiveLock *windowsLock;
*/ */
- (void) initDefaults - (void) initDefaults
{ {
first_responder = nil; first_responder = self;
original_responder = nil; original_responder = nil;
_initial_first_responder = nil; _initial_first_responder = nil;
delegate = nil; delegate = nil;