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

Method getKeyMap

src/lib/platform/MSWindowsKeyState.cpp:862–1161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

860}
861
862void MSWindowsKeyState::getKeyMap(deskflow::KeyMap &keyMap)
863{
864 // update keyboard groups
865 if (getGroups(m_groups)) {
866 m_groupMap.clear();
867 int32_t numGroups = (int32_t)m_groups.size();
868 for (int32_t g = 0; g < numGroups; ++g) {
869 m_groupMap[m_groups[g]] = g;
870 }
871 }
872 HKL activeLayout = GetKeyboardLayout(0);
873
874 // clear table
875 memset(m_virtualKeyToButton, 0, sizeof(m_virtualKeyToButton));
876 m_keyToVKMap.clear();
877
878 deskflow::KeyMap::KeyItem item;
879 int32_t numGroups = (int32_t)m_groups.size();
880 for (int32_t g = 0; g < numGroups; ++g) {
881 item.m_group = g;
882 ActivateKeyboardLayout(m_groups[g], 0);
883
884 // clear tables
885 memset(m_buttonToVK, 0, sizeof(m_buttonToVK));
886 memset(m_buttonToNumpadVK, 0, sizeof(m_buttonToNumpadVK));
887
888 // map buttons (scancodes) to virtual keys
889 for (KeyButton i = 1; i < 256; ++i) {
890 UINT vk = MapVirtualKey(i, 1);
891 if (vk == 0) {
892 // unmapped
893 continue;
894 }
895
896 // deal with certain virtual keys specially
897 switch (vk) {
898 case VK_SHIFT:
899 // this is important for sending the correct modifier to the
900 // client, a patch from bug #242 (right shift broken for ms
901 // remote desktop) removed this to just use left shift, which
902 // caused bug #2799 (right shift broken for osx).
903 // we must not repeat this same mistake and must fix platform
904 // specific bugs in code that only affects that platform.
905 if (MapVirtualKey(VK_RSHIFT, 0) == i) {
906 vk = VK_RSHIFT;
907 } else {
908 vk = VK_LSHIFT;
909 }
910 break;
911
912 case VK_CONTROL:
913 vk = VK_LCONTROL;
914 break;
915
916 case VK_MENU:
917 vk = VK_LMENU;
918 break;
919

Callers

nothing calls this directly

Calls 2

sizeMethod · 0.80
clearMethod · 0.45

Tested by

no test coverage detected