use key equivalent modifier mask.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@22848 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2006-05-01 18:39:03 +00:00
parent cbac796781
commit 3e3154f2f6
2 changed files with 18 additions and 13 deletions

View file

@ -1,6 +1,14 @@
2006-05-01 Richard Frith-Macdonald <rfm@gnu.org>
* 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 <rfm@gnu.org> 2006-04-30 Richard Frith-Macdonald <rfm@gnu.org>
* 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. than carriage return if the command key is not pressed.
2006-04-30 David Ayers <d.ayers@inode.at> 2006-04-30 David Ayers <d.ayers@inode.at>

View file

@ -954,6 +954,8 @@ static NSNotificationCenter *nc;
unsigned i; unsigned i;
unsigned count = [_items count]; unsigned count = [_items count];
NSEventType type = [theEvent type]; NSEventType type = [theEvent type];
unsigned modifiers = [theEvent modifierFlags];
NSString *keyEquivalent = [theEvent charactersIgnoringModifiers];
if (type != NSKeyDown && type != NSKeyUp) if (type != NSKeyDown && type != NSKeyUp)
return NO; return NO;
@ -973,14 +975,10 @@ static NSNotificationCenter *nc;
} }
else else
{ {
if ([[item keyEquivalent] isEqualToString: unsigned mask = [item keyEquivalentModifierMask];
[theEvent charactersIgnoringModifiers]])
{ 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])
{ {
@ -990,7 +988,6 @@ static NSNotificationCenter *nc;
} }
} }
} }
}
return NO; return NO;
} }