Windows input - Added black magic

This commit is contained in:
Diogo Trindade committed 2023-04-02 04:11:52 +01:00
1 parent 3d3c7ebbfd
commit 93dafd420e
5 files changed
+628 -1359

No files matched your search

@@ -532,5 +532,20 @@ public enum KeyboardKey
DeadCharProcessed = 172, // 0x000000AC,
/// <summary>The NumPad enter key</summary>
NumPadEnter
NumPadEnter,
/// <summary>The NumPad divide key</summary>
NumPadDivide,
/// <summary>The NumPad multiply key</summary>
NumPadMultiply,
/// <summary>The NumPad subtract key</summary>
NumPadSubtract,
/// <summary>The NumPad add key</summary>
NumPadAdd,
/// <summary>The NumPad decimal key</summary>
NumPadDecimal,
}
@@ -166,7 +166,7 @@ public static class InputKeyUtilities
{KeyboardKey.OemPipe, LedId.Keyboard_Backslash},
{KeyboardKey.OemCloseBrackets, LedId.Keyboard_BracketRight},
{KeyboardKey.OemQuotes, LedId.Keyboard_ApostropheAndDoubleQuote},
{KeyboardKey.OemBackslash, LedId.Keyboard_Custom42}, // unverified
{KeyboardKey.OemBackslash, LedId.Keyboard_NonUsBackslash},
{KeyboardKey.ImeProcessed, LedId.Keyboard_Custom43},
{KeyboardKey.System, LedId.Keyboard_Custom44},
{KeyboardKey.OemAttn, LedId.Keyboard_Custom45},
@@ -185,7 +185,12 @@ public static class InputKeyUtilities
{KeyboardKey.Pa1, LedId.Keyboard_Custom57},
{KeyboardKey.OemClear, LedId.Keyboard_Custom58},
{KeyboardKey.DeadCharProcessed, LedId.Keyboard_Custom59},
{KeyboardKey.NumPadEnter, LedId.Keyboard_NumEnter}
{KeyboardKey.NumPadEnter, LedId.Keyboard_NumEnter},
{KeyboardKey.NumPadDecimal, LedId.Keyboard_NumPeriodAndDelete},
{KeyboardKey.NumPadDivide, LedId.Keyboard_NumSlash},
{KeyboardKey.NumPadMultiply, LedId.Keyboard_NumAsterisk},
{KeyboardKey.NumPadSubtract, LedId.Keyboard_NumMinus},
{KeyboardKey.NumPadAdd, LedId.Keyboard_NumPlus},
};
/// <summary>
@@ -269,6 +269,13 @@ internal class InputService : IInputService
// Get the LED
bool foundLedId = InputKeyUtilities.KeyboardKeyLedIdMap.TryGetValue(e.Key, out LedId ledId);
// If we find a backslash but the keyboard is ISO, we need to use the non-US backslash.
// The scancode is the same, but the LED ID is different
if (ledId == LedId.Keyboard_Backslash && e.Device?.PhysicalLayout == KeyboardLayoutType.ISO)
{
ledId = LedId.Keyboard_NonUsTilde;
}
ArtemisLed? led = null;
if (foundLedId && e.Device != null)
led = e.Device.GetLed(ledId, true);