#2765 Made sure required modifiers already down when map command keys

This commit is contained in:
Jerry (Xinyu Hou) 2016-08-16 14:45:00 +01:00 committed by Andrew Nelless
parent bbb652e504
commit 178b7cc673
1 changed files with 10 additions and 7 deletions

View File

@ -535,14 +535,17 @@ KeyMap::mapCommandKey(Keystrokes& keys, KeyID id, SInt32 group,
continue;
}
// only match based on shift; we're after the right button
// not the right character. we'll use desiredMask as-is,
// overriding the key's required modifiers, when synthesizing
// this button.
// match based on shift and make sure all required modifiers,
// except shift, are already in the desired mask; we're
// after the right button not the right character.
// we'll use desiredMask as-is, overriding the key's required
// modifiers, when synthesizing this button.
const KeyItem& item = entryList[i].back();
if ((item.m_required & KeyModifierShift & desiredMask) ==
(item.m_sensitive & KeyModifierShift & desiredMask)) {
LOG((CLOG_DEBUG1 "found key in group %d", effectiveGroup));
KeyModifierMask desiredShiftMask = KeyModifierShift & desiredMask;
KeyModifierMask requiredIgnoreShiftMask = item.m_required & ~KeyModifierShift;
if ((item.m_required & desiredShiftMask) == (item.m_sensitive & desiredShiftMask) &&
((requiredIgnoreShiftMask & desiredMask) == requiredIgnoreShiftMask)) {
LOG((CLOG_INFO "found key in group %d", effectiveGroup));
keyItem = &item;
break;
}