mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
[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:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user