mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-12 18:29:24 +08:00
Handle RAlt, RCtrl and other extended keys correctly (dev/build-features) (#2145)
* Fixed SendInput for RAlt and RCtrl * Fixed shortcuts containing Del, Arrow keys, etc
This commit is contained in:
parent
10c0325f18
commit
13a8ac3e50
@ -26,3 +26,19 @@ IInspectable getSiblingElement(IInspectable const& element)
|
||||
parentElement.Children().IndexOf(frameworkElement, index);
|
||||
return parentElement.Children().GetAt(index + 1);
|
||||
}
|
||||
|
||||
// Function to return if the key is an extended key which requires the use of the extended key flag
|
||||
bool isExtendedKey(DWORD key)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case VK_RCONTROL:
|
||||
case VK_RMENU:
|
||||
case VK_NUMLOCK:
|
||||
case VK_SNAPSHOT:
|
||||
case VK_CANCEL:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -32,3 +32,6 @@ std::vector<T> convertWStringVectorToIntegerVector(const std::vector<std::wstrin
|
||||
|
||||
return typeVector;
|
||||
}
|
||||
|
||||
// Function to return if the key is an extended key which requires the use of the extended key flag
|
||||
bool isExtendedKey(DWORD key);
|
||||
|
@ -539,8 +539,8 @@ bool Shortcut::CheckModifiersKeyboardState() const
|
||||
// Function to check if any keys are pressed down except those in the shortcut
|
||||
bool Shortcut::IsKeyboardStateClearExceptShortcut() const
|
||||
{
|
||||
// Iterate through all the virtual key codes
|
||||
for (int keyVal = 0; keyVal < 0x100; keyVal++)
|
||||
// Iterate through all the virtual key codes - 0xFF is set to key down because of the Num Lock
|
||||
for (int keyVal = 0; keyVal < 0xFF; keyVal++)
|
||||
{
|
||||
// Skip mouse buttons. Keeping this could cause a remapping to fail if a mouse button is also pressed at the same time
|
||||
if (keyVal == VK_LBUTTON || keyVal == VK_RBUTTON || keyVal == VK_MBUTTON || keyVal == VK_XBUTTON1 || keyVal == VK_XBUTTON2)
|
||||
|
@ -152,7 +152,7 @@ public:
|
||||
PowerToysSettings::CustomActionObject::from_json_string(action);
|
||||
HINSTANCE hInstance = reinterpret_cast<HINSTANCE>(&__ImageBase);
|
||||
|
||||
if (action_object.get_name() == L"RemapKeyboard")
|
||||
if (action_object.get_name() == L"RemapKeyboard")
|
||||
{
|
||||
if (!CheckEditKeyboardWindowActive())
|
||||
{
|
||||
@ -325,6 +325,10 @@ public:
|
||||
keyEventArray[index].type = inputType;
|
||||
keyEventArray[index].ki.wVk = keyCode;
|
||||
keyEventArray[index].ki.dwFlags = flags;
|
||||
if (isExtendedKey(keyCode))
|
||||
{
|
||||
keyEventArray[index].ki.dwFlags |= KEYEVENTF_EXTENDEDKEY;
|
||||
}
|
||||
keyEventArray[index].ki.dwExtraInfo = extraInfo;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user