MCPcopy Create free account
hub / github.com/deskflow/deskflow / keyForModifier

Method keyForModifier

src/lib/deskflow/KeyMap.cpp:671–688  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

669}
670
671const KeyMap::KeyItem *KeyMap::keyForModifier(KeyButton button, int32_t group, int32_t modifierBit) const
672{
673 assert(modifierBit >= 0 && modifierBit < kKeyModifierNumBits);
674 assert(group >= 0 && group < getNumGroups());
675
676 // find a key that generates the given modifier in the given group
677 // but doesn't use the given button, presumably because we're trying
678 // to generate a KeyID that's only bound the the given button.
679 // this is important when a shift button is modified by shift; we
680 // must use the other shift button to do the shifting.
681 const ModifierKeyItemList &items = m_modifierKeys[group * kKeyModifierNumBits + modifierBit];
682 for (const auto &item : items) {
683 if (item->m_button != button) {
684 return item;
685 }
686 }
687 return nullptr;
688}
689
690bool KeyMap::keysForKeyItem(
691 const KeyItem &keyItem, int32_t &group, ModifierToKeys &activeModifiers, KeyModifierMask &currentState,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected