mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 20:01:11 +00:00
Fix menu key equivalents to only trigger when the exact modifiers are held down
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@30626 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
3b806bf24c
commit
901555380c
2 changed files with 20 additions and 10 deletions
|
@ -1,3 +1,11 @@
|
|||
2010-06-08 Doug Simons <doug.simons@testplant.com>
|
||||
|
||||
* Source/NSMenu.m:
|
||||
Fix menu key equivalents to only trigger when the exact modifiers
|
||||
are held down. Previously, an item would activate even when additional
|
||||
modifiers were held down (e.g. typing Ctrl-Alt-x would activate a
|
||||
menu item whose key equivalent was Ctrl-x).
|
||||
|
||||
2010-06-07 Doug Simons <doug.simons@testplant.com>
|
||||
|
||||
* Source/NSMenuItem.m:
|
||||
|
|
|
@ -1247,18 +1247,20 @@ static BOOL menuBarVisible = YES;
|
|||
}
|
||||
else
|
||||
{
|
||||
unsigned mask = [item keyEquivalentModifierMask];
|
||||
static unsigned relevantModifiersMask = NSCommandKeyMask | NSAlternateKeyMask | NSShiftKeyMask | NSControlKeyMask;
|
||||
unsigned mask = [item keyEquivalentModifierMask];
|
||||
modifiers &= relevantModifiersMask; // mask out any irrelevant flags
|
||||
|
||||
if ([[item keyEquivalent] isEqualToString: keyEquivalent]
|
||||
&& (modifiers & mask) == mask)
|
||||
{
|
||||
if ([item isEnabled])
|
||||
{
|
||||
[_view performActionWithHighlightingForItemAtIndex: i];
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
&& modifiers == mask)
|
||||
{
|
||||
if ([item isEnabled])
|
||||
{
|
||||
[_view performActionWithHighlightingForItemAtIndex: i];
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue