git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4344 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 1999-06-02 20:40:09 +00:00
parent bfb3253bea
commit 1042d20507

View file

@ -577,32 +577,38 @@ static Class menuCellClass = nil;
- (BOOL) performKeyEquivalent: (NSEvent*)theEvent - (BOOL) performKeyEquivalent: (NSEvent*)theEvent
{ {
id cells = [menuCells itemArray]; id cells = [menuCells itemArray];
int i, count = [cells count]; unsigned i;
NSEventType type = [theEvent type]; unsigned count = [cells count];
NSEventType type = [theEvent type];
if (type != NSKeyDown && type != NSKeyUp) if (type != NSKeyDown && type != NSKeyUp)
return NO; return NO;
for (i = 0; i < count; i++) { for (i = 0; i < count; i++)
id<NSMenuItem> cell = [cells objectAtIndex: i]; {
id<NSMenuItem> cell = [cells objectAtIndex: i];
if ([cell hasSubmenu]) { if ([cell hasSubmenu])
if ([[cell target] performKeyEquivalent: theEvent]) {
/* The event has been handled by a cell in submenu */ if ([[cell target] performKeyEquivalent: theEvent])
return YES; {
/* The event has been handled by a cell in submenu */
return YES;
}
}
else
{
if ([[cell keyEquivalent] isEqual:
[theEvent charactersIgnoringModifiers]])
{
[menuCells lockFocus];
[(id)cell performClick: self];
[menuCells unlockFocus];
return YES;
}
}
} }
else {
if ([[cell keyEquivalent] isEqual: [theEvent charactersIgnoringModifiers]]
&& [cell keyEquivalentModifierMask] == [theEvent modifierFlags]) {
[menuCells lockFocus];
[(id)cell performClick: self];
[menuCells unlockFocus];
return YES;
}
}
}
return NO; return NO;
} }