void CKeyState::updateKeyMap() { // get the current keyboard map CKeyMap keyMap; getKeyMap(keyMap); m_keyMap.swap(keyMap); m_keyMap.finish(); // add special keys addCombinationEntries(); addKeypadEntries(); addAliasEntries(); }
void OSXKeyState::getKeyMap(synergy::KeyMap& keyMap) { // update keyboard groups if (getGroups(m_groups)) { m_groupMap.clear(); SInt32 numGroups = (SInt32)m_groups.size(); for (SInt32 g = 0; g < numGroups; ++g) { m_groupMap[m_groups[g]] = g; } } UInt32 keyboardType = LMGetKbdType(); for (SInt32 g = 0, n = (SInt32)m_groups.size(); g < n; ++g) { // add special keys getKeyMapForSpecialKeys(keyMap, g); const void* resource; bool layoutValid = false; // add regular keys // try uchr resource first #if defined(MAC_OS_X_VERSION_10_5) CFDataRef resourceRef = (CFDataRef)TISGetInputSourceProperty( m_groups[g], kTISPropertyUnicodeKeyLayoutData); layoutValid = resourceRef != NULL; if (layoutValid) resource = CFDataGetBytePtr(resourceRef); #else layoutValid = KLGetKeyboardLayoutProperty( m_groups[g], kKLuchrData, &resource); #endif if (layoutValid) { CUCHRKeyResource uchr(resource, keyboardType); if (uchr.isValid()) { LOG((CLOG_DEBUG1 "using uchr resource for group %d", g)); getKeyMap(keyMap, g, uchr); continue; } } LOG((CLOG_DEBUG1 "no keyboard resource for group %d", g)); } }