mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 10:46:33 +02:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user