mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 20:01:11 +00:00
Fix previous NSMenu change to ignore shift key except when a function
key is pressed. Change NSButton -performKeyEquivalent: in a similar way. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@30720 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
901555380c
commit
c4ad9a9278
3 changed files with 20 additions and 5 deletions
|
@ -1,3 +1,12 @@
|
|||
2010-06-15 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||
|
||||
* Source/NSMenu.m (-performKeyEquivalent:): Fix Doug's previous
|
||||
change to ignore the shift key except when a function key is
|
||||
pressed, as documented by Apple.
|
||||
* Source/NSButton.m (-performKeyEquivalent): Fix to trigger only
|
||||
when command, alternate, and control keys match the modifier mask
|
||||
exactly, as documented by Apple.
|
||||
|
||||
2010-06-08 Doug Simons <doug.simons@testplant.com>
|
||||
|
||||
* Source/NSMenu.m:
|
||||
|
|
|
@ -519,9 +519,11 @@ static id buttonCellClass = nil;
|
|||
|
||||
if (key != nil && [key isEqual: [anEvent charactersIgnoringModifiers]])
|
||||
{
|
||||
const unsigned int relevantMask =
|
||||
NSCommandKeyMask | NSAlternateKeyMask | NSControlKeyMask;
|
||||
unsigned int mask = [self keyEquivalentModifierMask];
|
||||
|
||||
if (([anEvent modifierFlags] & mask) == mask)
|
||||
if (([anEvent modifierFlags] & relevantMask) == (mask & relevantMask))
|
||||
{
|
||||
[self performClick: self];
|
||||
return YES;
|
||||
|
|
|
@ -1247,12 +1247,16 @@ static BOOL menuBarVisible = YES;
|
|||
}
|
||||
else
|
||||
{
|
||||
static unsigned relevantModifiersMask = NSCommandKeyMask | NSAlternateKeyMask | NSShiftKeyMask | NSControlKeyMask;
|
||||
unsigned mask = [item keyEquivalentModifierMask];
|
||||
modifiers &= relevantModifiersMask; // mask out any irrelevant flags
|
||||
unsigned int relevantMask =
|
||||
NSCommandKeyMask | NSAlternateKeyMask | NSControlKeyMask;
|
||||
unsigned int mask = [item keyEquivalentModifierMask];
|
||||
|
||||
if (modifiers & NSFunctionKeyMask)
|
||||
{
|
||||
relevantMask |= NSShiftKeyMask;
|
||||
}
|
||||
if ([[item keyEquivalent] isEqualToString: keyEquivalent]
|
||||
&& modifiers == mask)
|
||||
&& (modifiers & relevantMask) == (mask & relevantMask))
|
||||
{
|
||||
if ([item isEnabled])
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue