mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Windows input - Added black magic
This commit is contained in:
parent
3d3c7ebbfd
commit
93dafd420e
@ -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);
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Timers;
|
||||
@ -98,7 +98,7 @@ public class WindowsInputProvider : InputProvider
|
||||
|
||||
private void HandleKeyboardData(RawInputData data, RawInputKeyboardData keyboardData)
|
||||
{
|
||||
KeyboardKey key = InputUtilities.KeyFromVirtualKey(keyboardData.Keyboard.VirutalKey);
|
||||
KeyboardKey key = InputUtilities.CorrectVirtualKeyAndScanCode((uint)keyboardData.Keyboard.VirutalKey, (uint)keyboardData.Keyboard.ScanCode, (uint)keyboardData.Keyboard.Flags);
|
||||
// Debug.WriteLine($"VK: {key} ({keyboardData.Keyboard.VirutalKey}), Flags: {keyboardData.Keyboard.Flags}, Scan code: {keyboardData.Keyboard.ScanCode}");
|
||||
|
||||
// Sometimes we get double hits and they resolve to None, ignore those
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user