Add support for Common Win key in KBM (#2308)

* Added common win key to layoutmap

* Added common win key support for edit shortcuts

* Adjusted key names
This commit is contained in:
Arjun Balgovind
2020-04-23 08:37:52 -07:00
committed by GitHub
parent d941b31c45
commit 32ddf3246c
9 changed files with 69 additions and 46 deletions

View File

@@ -147,7 +147,7 @@ void createEditKeyboardWindow(HINSTANCE hInst, KeyboardManagerState& keyboardMan
std::unordered_map<DWORD, DWORD> singleKeyRemapCopy = keyboardManagerState.singleKeyReMap;
lock.unlock();
// Pre process the table to combine L and R versions of Ctrl/Alt/Shift that are mapped to the same key
// Pre process the table to combine L and R versions of Ctrl/Alt/Shift/Win that are mapped to the same key
if (singleKeyRemapCopy.find(VK_LCONTROL) != singleKeyRemapCopy.end() && singleKeyRemapCopy.find(VK_RCONTROL) != singleKeyRemapCopy.end())
{
// If they are mapped to the same key, delete those entries and set the common version
@@ -178,6 +178,16 @@ void createEditKeyboardWindow(HINSTANCE hInst, KeyboardManagerState& keyboardMan
singleKeyRemapCopy.erase(VK_RSHIFT);
}
}
if (singleKeyRemapCopy.find(VK_LWIN) != singleKeyRemapCopy.end() && singleKeyRemapCopy.find(VK_RWIN) != singleKeyRemapCopy.end())
{
// If they are mapped to the same key, delete those entries and set the common version
if (singleKeyRemapCopy[VK_LWIN] == singleKeyRemapCopy[VK_RWIN])
{
singleKeyRemapCopy[CommonSharedConstants::VK_WIN_BOTH] = singleKeyRemapCopy[VK_LWIN];
singleKeyRemapCopy.erase(VK_LWIN);
singleKeyRemapCopy.erase(VK_RWIN);
}
}
for (const auto& it : singleKeyRemapCopy)
{
@@ -220,6 +230,11 @@ void createEditKeyboardWindow(HINSTANCE hInst, KeyboardManagerState& keyboardMan
res2 = keyboardManagerState.AddSingleKeyRemap(VK_RSHIFT, newKey);
result = res1 && res2;
break;
case CommonSharedConstants::VK_WIN_BOTH:
res1 = keyboardManagerState.AddSingleKeyRemap(VK_LWIN, newKey);
res2 = keyboardManagerState.AddSingleKeyRemap(VK_RWIN, newKey);
result = res1 && res2;
break;
default:
result = keyboardManagerState.AddSingleKeyRemap(originalKey, newKey);
}