Fix longstanding bug in key equivalents handling which was previously masked by a bug in NSApplication.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@22843 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2006-04-30 20:29:30 +00:00
parent 66fd293df6
commit cbac796781
2 changed files with 16 additions and 6 deletions

View file

@ -1,3 +1,8 @@
2006-04-30 Richard Frith-Macdonald <rfm@gnu.org>
* NSMenu.m: ([performKeyEquivalent:]) Ignore key eqivalents other
than carriage return if the command key is not pressed.
2006-04-30 David Ayers <d.ayers@inode.at>
* ColorPickers/GSNamedColorPicker.m ([-browser:selectRow:inColumn:]):

View file

@ -964,8 +964,7 @@ static NSNotificationCenter *nc;
if ([item hasSubmenu])
{
// FIXME: Should we only check active submenus?
// Recurse through submenus.
// Recurse through submenus whether active or not.
if ([[item submenu] performKeyEquivalent: theEvent])
{
// The event has been handled by an item in the submenu.
@ -974,15 +973,21 @@ static NSNotificationCenter *nc;
}
else
{
// FIXME: Should also check the modifier mask
if ([[item keyEquivalent] isEqualToString:
[theEvent charactersIgnoringModifiers]])
{
if ([item isEnabled])
/*
* Must be carriage return or have the command key modifier
*/
if ([[item keyEquivalent] isEqualToString: @"\r"]
|| ([theEvent modifierFlags] & NSCommandKeyMask))
{
[_view performActionWithHighlightingForItemAtIndex: i];
if ([item isEnabled])
{
[_view performActionWithHighlightingForItemAtIndex: i];
}
return YES;
}
return YES;
}
}
}