mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
Fixed KBM shortcut remapping not working after using Japanese IME (#6450)
This commit is contained in:
@@ -613,14 +613,35 @@ bool Shortcut::CheckModifiersKeyboardState(InputInterface& ii) const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Function to check if the key code is to be ignored
|
||||||
|
bool IgnoreKeyCode(DWORD key)
|
||||||
|
{
|
||||||
|
switch (key)
|
||||||
|
{
|
||||||
|
// Ignore mouse buttons. Keeping this could cause a remapping to fail if a mouse button is also pressed at the same time
|
||||||
|
case VK_LBUTTON:
|
||||||
|
case VK_RBUTTON:
|
||||||
|
case VK_MBUTTON:
|
||||||
|
case VK_XBUTTON1:
|
||||||
|
case VK_XBUTTON2:
|
||||||
|
// Ignore these key codes as they are reserved. Used by IME keyboards. More information at https://github.com/microsoft/PowerToys/issues/5225
|
||||||
|
case 0xF0:
|
||||||
|
case 0xF1:
|
||||||
|
case 0xF2:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Function to check if any keys are pressed down except those in the shortcut
|
// Function to check if any keys are pressed down except those in the shortcut
|
||||||
bool Shortcut::IsKeyboardStateClearExceptShortcut(InputInterface& ii) const
|
bool Shortcut::IsKeyboardStateClearExceptShortcut(InputInterface& ii) const
|
||||||
{
|
{
|
||||||
// Iterate through all the virtual key codes - 0xFF is set to key down because of the Num Lock
|
// Iterate through all the virtual key codes - 0xFF is set to key down because of the Num Lock
|
||||||
for (int keyVal = 1; keyVal < 0xFF; keyVal++)
|
for (int keyVal = 1; 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
|
// Ignore problematic key codes
|
||||||
if (keyVal == VK_LBUTTON || keyVal == VK_RBUTTON || keyVal == VK_MBUTTON || keyVal == VK_XBUTTON1 || keyVal == VK_XBUTTON2)
|
if (IgnoreKeyCode(keyVal))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user