[KBM Editor] fix crash when mapping left and right modifier to the combined key. (#12999)

* [KBM Editor] Don't combine keys to same key

* Avoid crashes when flyouts can't be shown yet

* Disallow mapping of left or right key to combined

* Refactor remap to combined key check

* Add log message when flyout fails to load
This commit is contained in:
Jaime Bernardo
2021-09-03 16:19:16 +01:00
committed by GitHub
parent 4a1e21ac83
commit b8236d55e2
6 changed files with 55 additions and 3 deletions

View File

@@ -15,6 +15,27 @@ namespace Helpers
return (GetKeyType(key) != KeyType::Action);
}
// Function to get the combined key for modifier keys
DWORD GetCombinedKey(DWORD key)
{
switch (key) {
case VK_LWIN:
case VK_RWIN:
return CommonSharedConstants::VK_WIN_BOTH;
case VK_LCONTROL:
case VK_RCONTROL:
return VK_CONTROL;
case VK_LMENU:
case VK_RMENU:
return VK_MENU;
case VK_LSHIFT:
case VK_RSHIFT:
return VK_SHIFT;
default:
return key;
}
}
// Function to get the type of the key
KeyType GetKeyType(DWORD key)
{