| 455 | } |
| 456 | |
| 457 | void 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 | |
| 501 | CGEventFlags OSXKeyState::getDeviceDependedFlags() const |
| 502 | { |
nothing calls this directly
no test coverage detected