Revert "Used input source ID as the key in group map #2765"

This reverts commit 4208e89eaec211d332af9ac7b977107d6712e8dd.
This commit is contained in:
Jerry (Xinyu Hou) 2016-07-20 10:11:25 -07:00
parent 2a3d34983f
commit a70cba80ea
2 changed files with 8 additions and 12 deletions

View File

@ -379,17 +379,15 @@ OSXKeyState::pollActiveModifiers() const
SInt32
OSXKeyState::pollActiveGroup() const
{
bool layoutValid = true;
TISInputSourceRef keyboardLayout = TISCopyCurrentKeyboardLayoutInputSource();
CFDataRef id = (CFDataRef)TISGetInputSourceProperty(
keyboardLayout, kTISPropertyInputSourceID);
GroupMap::const_iterator i = m_groupMap.find(id);
if (i != m_groupMap.end()) {
return i->second;
if (layoutValid) {
GroupMap::const_iterator i = m_groupMap.find(keyboardLayout);
if (i != m_groupMap.end()) {
return i->second;
}
}
LOG((CLOG_DEBUG "can't get the active group, use the first group instead"));
return 0;
}
@ -416,9 +414,7 @@ OSXKeyState::getKeyMap(synergy::KeyMap& keyMap)
m_groupMap.clear();
SInt32 numGroups = (SInt32)m_groups.size();
for (SInt32 g = 0; g < numGroups; ++g) {
CFDataRef id = (CFDataRef)TISGetInputSourceProperty(
m_groups[g], kTISPropertyInputSourceID);
m_groupMap[id] = g;
m_groupMap[m_groups[g]] = g;
}
}

View File

@ -158,7 +158,7 @@ private:
KeyButtonOffset = 1
};
typedef std::map<CFDataRef, SInt32> GroupMap;
typedef std::map<KeyLayout, SInt32> GroupMap;
typedef std::map<UInt32, KeyID> VirtualKeyMap;
VirtualKeyMap m_virtualKeyMap;