#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; continue;
} }
// only match based on shift; we're after the right button // match based on shift and make sure all required modifiers,
// not the right character. we'll use desiredMask as-is, // except shift, are already in the desired mask; we're
// overriding the key's required modifiers, when synthesizing // after the right button not the right character.
// this button. // we'll use desiredMask as-is, overriding the key's required
// modifiers, when synthesizing this button.
const KeyItem& item = entryList[i].back(); const KeyItem& item = entryList[i].back();
if ((item.m_required & KeyModifierShift & desiredMask) == KeyModifierMask desiredShiftMask = KeyModifierShift & desiredMask;
(item.m_sensitive & KeyModifierShift & desiredMask)) { KeyModifierMask requiredIgnoreShiftMask = item.m_required & ~KeyModifierShift;
LOG((CLOG_DEBUG1 "found key in group %d", effectiveGroup)); if ((item.m_required & desiredShiftMask) == (item.m_sensitive & desiredShiftMask) &&
((requiredIgnoreShiftMask & desiredMask) == requiredIgnoreShiftMask)) {
LOG((CLOG_INFO "found key in group %d", effectiveGroup));
keyItem = &item; keyItem = &item;
break; break;
} }