Used input source ID as the key in group map #2765
This commit is contained in:
parent
583ac1ed2d
commit
6d93a28c2e
|
@ -379,15 +379,17 @@ OSXKeyState::pollActiveModifiers() const
|
||||||
SInt32
|
SInt32
|
||||||
OSXKeyState::pollActiveGroup() const
|
OSXKeyState::pollActiveGroup() const
|
||||||
{
|
{
|
||||||
bool layoutValid = true;
|
|
||||||
TISInputSourceRef keyboardLayout = TISCopyCurrentKeyboardLayoutInputSource();
|
TISInputSourceRef keyboardLayout = TISCopyCurrentKeyboardLayoutInputSource();
|
||||||
|
CFDataRef id = (CFDataRef)TISGetInputSourceProperty(
|
||||||
|
keyboardLayout, kTISPropertyInputSourceID);
|
||||||
|
|
||||||
if (layoutValid) {
|
GroupMap::const_iterator i = m_groupMap.find(id);
|
||||||
GroupMap::const_iterator i = m_groupMap.find(keyboardLayout);
|
if (i != m_groupMap.end()) {
|
||||||
if (i != m_groupMap.end()) {
|
return i->second;
|
||||||
return i->second;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOG((CLOG_DEBUG "can't get the active group, use the first group instead"));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -414,7 +416,9 @@ OSXKeyState::getKeyMap(synergy::KeyMap& keyMap)
|
||||||
m_groupMap.clear();
|
m_groupMap.clear();
|
||||||
SInt32 numGroups = (SInt32)m_groups.size();
|
SInt32 numGroups = (SInt32)m_groups.size();
|
||||||
for (SInt32 g = 0; g < numGroups; ++g) {
|
for (SInt32 g = 0; g < numGroups; ++g) {
|
||||||
m_groupMap[m_groups[g]] = g;
|
CFDataRef id = (CFDataRef)TISGetInputSourceProperty(
|
||||||
|
m_groups[g], kTISPropertyInputSourceID);
|
||||||
|
m_groupMap[id] = g;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -158,7 +158,7 @@ private:
|
||||||
KeyButtonOffset = 1
|
KeyButtonOffset = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::map<KeyLayout, SInt32> GroupMap;
|
typedef std::map<CFDataRef, SInt32> GroupMap;
|
||||||
typedef std::map<UInt32, KeyID> VirtualKeyMap;
|
typedef std::map<UInt32, KeyID> VirtualKeyMap;
|
||||||
|
|
||||||
VirtualKeyMap m_virtualKeyMap;
|
VirtualKeyMap m_virtualKeyMap;
|
||||||
|
|
Loading…
Reference in New Issue