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

Method getKeyMap

src/lib/platform/OSXKeyState.cpp:457–499  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

455}
456
457void OSXKeyState::getKeyMap(deskflow::KeyMap &keyMap)
458{
459 // update keyboard groups
460 int32_t numGroups{0};
461 if (getGroups(m_groups)) {
462 m_groupMap.clear();
463 numGroups = CFArrayGetCount(m_groups.get());
464 for (int32_t g = 0; g < numGroups; ++g) {
465 TISInputSourceRef keyboardLayout = (TISInputSourceRef)CFArrayGetValueAtIndex(m_groups.get(), g);
466 CFDataRef id = (CFDataRef)TISGetInputSourceProperty(keyboardLayout, kTISPropertyInputSourceID);
467 m_groupMap[id] = g;
468 }
469 }
470
471 uint32_t keyboardType = LMGetKbdType();
472 for (int32_t g = 0; g < numGroups; ++g) {
473 // add special keys
474 getKeyMapForSpecialKeys(keyMap, g);
475
476 const void *resource;
477 bool layoutValid = false;
478
479 // add regular keys
480 // try uchr resource first
481 TISInputSourceRef keyboardLayout = (TISInputSourceRef)CFArrayGetValueAtIndex(m_groups.get(), g);
482 CFDataRef resourceRef = (CFDataRef)TISGetInputSourceProperty(keyboardLayout, kTISPropertyUnicodeKeyLayoutData);
483
484 layoutValid = resourceRef != nullptr;
485 if (layoutValid)
486 resource = CFDataGetBytePtr(resourceRef);
487
488 if (layoutValid) {
489 OSXUchrKeyResource uchr(resource, keyboardType);
490 if (uchr.isValid()) {
491 LOG_DEBUG1("using uchr resource for group %d", g);
492 getKeyMap(keyMap, g, uchr);
493 continue;
494 }
495 }
496
497 LOG_DEBUG1("no keyboard resource for group %d", g);
498 }
499}
500
501CGEventFlags OSXKeyState::getDeviceDependedFlags() const
502{

Callers

nothing calls this directly

Calls 13

getNumTablesMethod · 0.80
getNumButtonsMethod · 0.80
addHalfDuplexButtonMethod · 0.80
getTableForModifierMethod · 0.80
clearMethod · 0.45
getMethod · 0.45
isValidMethod · 0.45
getKeyMethod · 0.45
insertMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected