diff --git a/ChangeLog b/ChangeLog index 0d6a0d1dd..1c9bcabde 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,14 @@ +2006-05-01 Richard Frith-Macdonald + + * Source/NSMatrix..m: ([performKeyEquivalent:]) Check modifier flags + of cells when determining whether to perform their key equivalents. + * Source/NSMenu.m: ([performKeyEquivalent:]) Use key equivalent + modifier mask as suggested by Fred, rather than original hard-coded + command modifier. + 2006-04-30 Richard Frith-Macdonald - * NSMenu.m: ([performKeyEquivalent:]) Ignore key eqivalents other + * Source/NSMenu.m: ([performKeyEquivalent:]) Ignore key eqivalents other than carriage return if the command key is not pressed. 2006-04-30 David Ayers diff --git a/Source/NSMenu.m b/Source/NSMenu.m index 602edc86d..e877851fd 100644 --- a/Source/NSMenu.m +++ b/Source/NSMenu.m @@ -954,6 +954,8 @@ static NSNotificationCenter *nc; unsigned i; unsigned count = [_items count]; NSEventType type = [theEvent type]; + unsigned modifiers = [theEvent modifierFlags]; + NSString *keyEquivalent = [theEvent charactersIgnoringModifiers]; if (type != NSKeyDown && type != NSKeyUp) return NO; @@ -973,21 +975,16 @@ static NSNotificationCenter *nc; } else { - if ([[item keyEquivalent] isEqualToString: - [theEvent charactersIgnoringModifiers]]) + unsigned mask = [item keyEquivalentModifierMask]; + + if ([[item keyEquivalent] isEqualToString: keyEquivalent] + && (modifiers & mask) == mask) { - /* - * Must be carriage return or have the command key modifier - */ - if ([[item keyEquivalent] isEqualToString: @"\r"] - || ([theEvent modifierFlags] & NSCommandKeyMask)) + if ([item isEnabled]) { - if ([item isEnabled]) - { - [_view performActionWithHighlightingForItemAtIndex: i]; - } - return YES; + [_view performActionWithHighlightingForItemAtIndex: i]; } + return YES; } } }