mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Merge branch 'development' into feature/update-avalonia
This commit is contained in:
commit
6b65a64ee2
@ -4,533 +4,419 @@
|
||||
public enum KeyboardKey
|
||||
{
|
||||
/// <summary>No key pressed.</summary>
|
||||
None = 0,
|
||||
|
||||
/// <summary>The Cancel key.</summary>
|
||||
Cancel = 1,
|
||||
None,
|
||||
|
||||
/// <summary>The Backspace key.</summary>
|
||||
Back = 2,
|
||||
Backspace,
|
||||
|
||||
/// <summary>The Tab key.</summary>
|
||||
Tab = 3,
|
||||
|
||||
/// <summary>The Linefeed key.</summary>
|
||||
LineFeed = 4,
|
||||
Tab,
|
||||
|
||||
/// <summary>The Clear key.</summary>
|
||||
Clear = 5,
|
||||
Clear,
|
||||
|
||||
/// <summary>The Enter key.</summary>
|
||||
Enter = 6,
|
||||
|
||||
/// <summary>The Return key.</summary>
|
||||
Return = 6,
|
||||
Enter,
|
||||
|
||||
/// <summary>The Pause key.</summary>
|
||||
Pause = 7,
|
||||
PauseBreak,
|
||||
|
||||
/// <summary>The Caps Lock key.</summary>
|
||||
CapsLock = 8,
|
||||
CapsLock,
|
||||
|
||||
/// <summary>The IME Hangul mode key.</summary>
|
||||
HangulMode = 9,
|
||||
/// <summary>The Escape key.</summary>
|
||||
Escape,
|
||||
|
||||
/// <summary>The IME Junja mode key.</summary>
|
||||
JunjaMode = 10, // 0x0000000A
|
||||
|
||||
/// <summary>The IME Final mode key.</summary>
|
||||
FinalMode = 11, // 0x0000000B
|
||||
|
||||
/// <summary>The IME Hanja mode key.</summary>
|
||||
HanjaMode = 12, // 0x0000000C
|
||||
|
||||
/// <summary>The ESC key.</summary>
|
||||
Escape = 13, // 0x0000000D
|
||||
|
||||
/// <summary>The IME Convert key.</summary>
|
||||
ImeConvert = 14, // 0x0000000E
|
||||
|
||||
/// <summary>The IME NonConvert key.</summary>
|
||||
ImeNonConvert = 15, // 0x0000000F
|
||||
|
||||
/// <summary>The IME Accept key.</summary>
|
||||
ImeAccept = 16, // 0x00000010
|
||||
|
||||
/// <summary>The IME Mode change request.</summary>
|
||||
ImeModeChange = 17, // 0x00000011
|
||||
|
||||
/// <summary>The Spacebar key.</summary>
|
||||
Space = 18, // 0x00000012
|
||||
/// <summary>The Space bar key.</summary>
|
||||
Space,
|
||||
|
||||
/// <summary>The Page Up key.</summary>
|
||||
PageUp = 19, // 0x00000013
|
||||
|
||||
/// <summary>The Page Up key.</summary>
|
||||
Prior = 19, // 0x00000013
|
||||
PageUp,
|
||||
|
||||
/// <summary>The Page Down key.</summary>
|
||||
Next = 20, // 0x00000014
|
||||
|
||||
/// <summary>The Page Down key.</summary>
|
||||
PageDown = 20, // 0x00000014
|
||||
PageDown,
|
||||
|
||||
/// <summary>The End key.</summary>
|
||||
End = 21, // 0x00000015
|
||||
End,
|
||||
|
||||
/// <summary>The Home key.</summary>
|
||||
Home = 22, // 0x00000016
|
||||
Home,
|
||||
|
||||
/// <summary>The Left Arrow key.</summary>
|
||||
Left = 23, // 0x00000017
|
||||
ArrowLeft,
|
||||
|
||||
/// <summary>The Up Arrow key.</summary>
|
||||
Up = 24, // 0x00000018
|
||||
ArrowUp,
|
||||
|
||||
/// <summary>The Right Arrow key.</summary>
|
||||
Right = 25, // 0x00000019
|
||||
ArrowRight,
|
||||
|
||||
/// <summary>The Down Arrow key.</summary>
|
||||
Down = 26, // 0x0000001A
|
||||
|
||||
/// <summary>The Select key.</summary>
|
||||
Select = 27, // 0x0000001B
|
||||
|
||||
/// <summary>The Print key.</summary>
|
||||
Print = 28, // 0x0000001C
|
||||
|
||||
/// <summary>The Execute key.</summary>
|
||||
Execute = 29, // 0x0000001D
|
||||
ArrowDown,
|
||||
|
||||
/// <summary>The Print Screen key.</summary>
|
||||
PrintScreen = 30, // 0x0000001E
|
||||
PrintScreen,
|
||||
|
||||
/// <summary>The Insert key.</summary>
|
||||
Insert = 31, // 0x0000001F
|
||||
Insert,
|
||||
|
||||
/// <summary>The Delete key.</summary>
|
||||
Delete = 32, // 0x00000020
|
||||
|
||||
/// <summary>The Help key.</summary>
|
||||
Help = 33, // 0x00000021
|
||||
Delete,
|
||||
|
||||
/// <summary>The 0 (zero) key.</summary>
|
||||
D0 = 34, // 0x00000022
|
||||
D0,
|
||||
|
||||
/// <summary>The 1 (one) key.</summary>
|
||||
D1 = 35, // 0x00000023
|
||||
D1,
|
||||
|
||||
/// <summary>The 2 key.</summary>
|
||||
D2 = 36, // 0x00000024
|
||||
D2,
|
||||
|
||||
/// <summary>The 3 key.</summary>
|
||||
D3 = 37, // 0x00000025
|
||||
D3,
|
||||
|
||||
/// <summary>The 4 key.</summary>
|
||||
D4 = 38, // 0x00000026
|
||||
D4,
|
||||
|
||||
/// <summary>The 5 key.</summary>
|
||||
D5 = 39, // 0x00000027
|
||||
D5,
|
||||
|
||||
/// <summary>The 6 key.</summary>
|
||||
D6 = 40, // 0x00000028
|
||||
D6,
|
||||
|
||||
/// <summary>The 7 key.</summary>
|
||||
D7 = 41, // 0x00000029
|
||||
D7,
|
||||
|
||||
/// <summary>The 8 key.</summary>
|
||||
D8 = 42, // 0x0000002A
|
||||
D8,
|
||||
|
||||
/// <summary>The 9 key.</summary>
|
||||
D9 = 43, // 0x0000002B
|
||||
D9,
|
||||
|
||||
/// <summary>The A key.</summary>
|
||||
A = 44, // 0x0000002C
|
||||
A,
|
||||
|
||||
/// <summary>The B key.</summary>
|
||||
B = 45, // 0x0000002D
|
||||
B,
|
||||
|
||||
/// <summary>The C key.</summary>
|
||||
C = 46, // 0x0000002E
|
||||
C,
|
||||
|
||||
/// <summary>The D key.</summary>
|
||||
D = 47, // 0x0000002F
|
||||
D,
|
||||
|
||||
/// <summary>The E key.</summary>
|
||||
E = 48, // 0x00000030
|
||||
E,
|
||||
|
||||
/// <summary>The F key.</summary>
|
||||
F = 49, // 0x00000031
|
||||
F,
|
||||
|
||||
/// <summary>The G key.</summary>
|
||||
G = 50, // 0x00000032
|
||||
G,
|
||||
|
||||
/// <summary>The H key.</summary>
|
||||
H = 51, // 0x00000033
|
||||
H,
|
||||
|
||||
/// <summary>The I key.</summary>
|
||||
I = 52, // 0x00000034
|
||||
I,
|
||||
|
||||
/// <summary>The J key.</summary>
|
||||
J = 53, // 0x00000035
|
||||
J,
|
||||
|
||||
/// <summary>The K key.</summary>
|
||||
K = 54, // 0x00000036
|
||||
K,
|
||||
|
||||
/// <summary>The L key.</summary>
|
||||
L = 55, // 0x00000037
|
||||
L,
|
||||
|
||||
/// <summary>The M key.</summary>
|
||||
M = 56, // 0x00000038
|
||||
M,
|
||||
|
||||
/// <summary>The N key.</summary>
|
||||
N = 57, // 0x00000039
|
||||
N,
|
||||
|
||||
/// <summary>The O key.</summary>
|
||||
O = 58, // 0x0000003A
|
||||
O,
|
||||
|
||||
/// <summary>The P key.</summary>
|
||||
P = 59, // 0x0000003B
|
||||
P,
|
||||
|
||||
/// <summary>The Q key.</summary>
|
||||
Q = 60, // 0x0000003C
|
||||
Q,
|
||||
|
||||
/// <summary>The R key.</summary>
|
||||
R = 61, // 0x0000003D
|
||||
R,
|
||||
|
||||
/// <summary>The S key.</summary>
|
||||
S = 62, // 0x0000003E
|
||||
S,
|
||||
|
||||
/// <summary>The T key.</summary>
|
||||
T = 63, // 0x0000003F
|
||||
T,
|
||||
|
||||
/// <summary>The U key.</summary>
|
||||
U = 64, // 0x00000040
|
||||
U,
|
||||
|
||||
/// <summary>The V key.</summary>
|
||||
V = 65, // 0x00000041
|
||||
V,
|
||||
|
||||
/// <summary>The W key.</summary>
|
||||
W = 66, // 0x00000042
|
||||
W,
|
||||
|
||||
/// <summary>The X key.</summary>
|
||||
X = 67, // 0x00000043
|
||||
X,
|
||||
|
||||
/// <summary>The Y key.</summary>
|
||||
Y = 68, // 0x00000044
|
||||
Y,
|
||||
|
||||
/// <summary>The Z key.</summary>
|
||||
Z = 69, // 0x00000045
|
||||
Z,
|
||||
|
||||
/// <summary>The left Windows logo key (Microsoft Natural Keyboard).</summary>
|
||||
LWin = 70, // 0x00000046
|
||||
LeftWin,
|
||||
|
||||
/// <summary>The right Windows logo key (Microsoft Natural Keyboard).</summary>
|
||||
RWin = 71, // 0x00000047
|
||||
RightWin,
|
||||
|
||||
/// <summary>
|
||||
/// The Application key (Microsoft Natural Keyboard). Also known as the Menu key, as it displays an
|
||||
/// application-specific context menu.
|
||||
/// </summary>
|
||||
Apps = 72, // 0x00000048
|
||||
/// <summary>The Application key. Displays an application-specific context menu.</summary>
|
||||
Application,
|
||||
|
||||
/// <summary>The Computer Sleep key.</summary>
|
||||
Sleep = 73, // 0x00000049
|
||||
|
||||
/// <summary>The 0 key on the numeric keypad.</summary>
|
||||
NumPad0 = 74, // 0x0000004A
|
||||
|
||||
/// <summary>The 1 key on the numeric keypad.</summary>
|
||||
NumPad1 = 75, // 0x0000004B
|
||||
|
||||
/// <summary>The 2 key on the numeric keypad.</summary>
|
||||
NumPad2 = 76, // 0x0000004C
|
||||
|
||||
/// <summary>The 3 key on the numeric keypad.</summary>
|
||||
NumPad3 = 77, // 0x0000004D
|
||||
|
||||
/// <summary>The 4 key on the numeric keypad.</summary>
|
||||
NumPad4 = 78, // 0x0000004E
|
||||
|
||||
/// <summary>The 5 key on the numeric keypad.</summary>
|
||||
NumPad5 = 79, // 0x0000004F
|
||||
|
||||
/// <summary>The 6 key on the numeric keypad.</summary>
|
||||
NumPad6 = 80, // 0x00000050
|
||||
|
||||
/// <summary>The 7 key on the numeric keypad.</summary>
|
||||
NumPad7 = 81, // 0x00000051
|
||||
|
||||
/// <summary>The 8 key on the numeric keypad.</summary>
|
||||
NumPad8 = 82, // 0x00000052
|
||||
|
||||
/// <summary>The 9 key on the numeric keypad.</summary>
|
||||
NumPad9 = 83, // 0x00000053
|
||||
|
||||
/// <summary>The Multiply key.</summary>
|
||||
Multiply = 84, // 0x00000054
|
||||
|
||||
/// <summary>The Add key.</summary>
|
||||
Add = 85, // 0x00000055
|
||||
|
||||
/// <summary>The Separator key.</summary>
|
||||
Separator = 86, // 0x00000056
|
||||
|
||||
/// <summary>The Subtract key.</summary>
|
||||
Subtract = 87, // 0x00000057
|
||||
|
||||
/// <summary>The Decimal key.</summary>
|
||||
Decimal = 88, // 0x00000058
|
||||
|
||||
/// <summary>The Divide key.</summary>
|
||||
Divide = 89, // 0x00000059
|
||||
|
||||
/// <summary>The F1 key.</summary>
|
||||
F1 = 90, // 0x0000005A
|
||||
|
||||
/// <summary>The F2 key.</summary>
|
||||
F2 = 91, // 0x0000005B
|
||||
|
||||
/// <summary>The F3 key.</summary>
|
||||
F3 = 92, // 0x0000005C
|
||||
|
||||
/// <summary>The F4 key.</summary>
|
||||
F4 = 93, // 0x0000005D
|
||||
|
||||
/// <summary>The F5 key.</summary>
|
||||
F5 = 94, // 0x0000005E
|
||||
|
||||
/// <summary>The F6 key.</summary>
|
||||
F6 = 95, // 0x0000005F
|
||||
|
||||
/// <summary>The F7 key.</summary>
|
||||
F7 = 96, // 0x00000060
|
||||
|
||||
/// <summary>The F8 key.</summary>
|
||||
F8 = 97, // 0x00000061
|
||||
|
||||
/// <summary>The F9 key.</summary>
|
||||
F9 = 98, // 0x00000062
|
||||
|
||||
/// <summary>The F10 key.</summary>
|
||||
F10 = 99, // 0x00000063
|
||||
|
||||
/// <summary>The F11 key.</summary>
|
||||
F11 = 100, // 0x00000064
|
||||
|
||||
/// <summary>The F12 key.</summary>
|
||||
F12 = 101, // 0x00000065
|
||||
|
||||
/// <summary>The F13 key.</summary>
|
||||
F13 = 102, // 0x00000066
|
||||
|
||||
/// <summary>The F14 key.</summary>
|
||||
F14 = 103, // 0x00000067
|
||||
|
||||
/// <summary>The F15 key.</summary>
|
||||
F15 = 104, // 0x00000068
|
||||
|
||||
/// <summary>The F16 key.</summary>
|
||||
F16 = 105, // 0x00000069
|
||||
|
||||
/// <summary>The F17 key.</summary>
|
||||
F17 = 106, // 0x0000006A
|
||||
|
||||
/// <summary>The F18 key.</summary>
|
||||
F18 = 107, // 0x0000006B
|
||||
|
||||
/// <summary>The F19 key.</summary>
|
||||
F19 = 108, // 0x0000006C
|
||||
|
||||
/// <summary>The F20 key.</summary>
|
||||
F20 = 109, // 0x0000006D
|
||||
|
||||
/// <summary>The F21 key.</summary>
|
||||
F21 = 110, // 0x0000006E
|
||||
|
||||
/// <summary>The F22 key.</summary>
|
||||
F22 = 111, // 0x0000006F
|
||||
|
||||
/// <summary>The F23 key.</summary>
|
||||
F23 = 112, // 0x00000070
|
||||
|
||||
/// <summary>The F24 key.</summary>
|
||||
F24 = 113, // 0x00000071
|
||||
Sleep,
|
||||
|
||||
/// <summary>The Num Lock key.</summary>
|
||||
NumLock = 114, // 0x00000072
|
||||
NumLock,
|
||||
|
||||
/// <summary>The Scroll Lock key.</summary>
|
||||
Scroll = 115, // 0x00000073
|
||||
/// <summary>The 0 key on the numeric keypad.</summary>
|
||||
NumPad0,
|
||||
|
||||
/// <summary>The left Shift key.</summary>
|
||||
LeftShift = 116, // 0x00000074
|
||||
/// <summary>The 1 key on the numeric keypad.</summary>
|
||||
NumPad1,
|
||||
|
||||
/// <summary>The right Shift key.</summary>
|
||||
RightShift = 117, // 0x00000075
|
||||
/// <summary>The 2 key on the numeric keypad.</summary>
|
||||
NumPad2,
|
||||
|
||||
/// <summary>The left CTRL key.</summary>
|
||||
LeftCtrl = 118, // 0x00000076
|
||||
/// <summary>The 3 key on the numeric keypad.</summary>
|
||||
NumPad3,
|
||||
|
||||
/// <summary>The right CTRL key.</summary>
|
||||
RightCtrl = 119, // 0x00000077
|
||||
/// <summary>The 4 key on the numeric keypad.</summary>
|
||||
NumPad4,
|
||||
|
||||
/// <summary>The left ALT key.</summary>
|
||||
LeftAlt = 120, // 0x00000078
|
||||
/// <summary>The 5 key on the numeric keypad.</summary>
|
||||
NumPad5,
|
||||
|
||||
/// <summary>The right ALT key.</summary>
|
||||
RightAlt = 121, // 0x00000079
|
||||
/// <summary>The 6 key on the numeric keypad.</summary>
|
||||
NumPad6,
|
||||
|
||||
/// <summary>The Browser Back key.</summary>
|
||||
BrowserBack = 122, // 0x0000007A
|
||||
/// <summary>The 7 key on the numeric keypad.</summary>
|
||||
NumPad7,
|
||||
|
||||
/// <summary>The Browser Forward key.</summary>
|
||||
BrowserForward = 123, // 0x0000007B
|
||||
/// <summary>The 8 key on the numeric keypad.</summary>
|
||||
NumPad8,
|
||||
|
||||
/// <summary>The Browser Refresh key.</summary>
|
||||
BrowserRefresh = 124, // 0x0000007C
|
||||
|
||||
/// <summary>The Browser Stop key.</summary>
|
||||
BrowserStop = 125, // 0x0000007D
|
||||
|
||||
/// <summary>The Browser Search key.</summary>
|
||||
BrowserSearch = 126, // 0x0000007E
|
||||
|
||||
/// <summary>The Browser Favorites key.</summary>
|
||||
BrowserFavorites = 127, // 0x0000007F
|
||||
|
||||
/// <summary>The Browser Home key.</summary>
|
||||
BrowserHome = 128, // 0x00000080
|
||||
|
||||
/// <summary>The Volume Mute key.</summary>
|
||||
VolumeMute = 129, // 0x00000081
|
||||
|
||||
/// <summary>The Volume Down key.</summary>
|
||||
VolumeDown = 130, // 0x00000082
|
||||
|
||||
/// <summary>The Volume Up key.</summary>
|
||||
VolumeUp = 131, // 0x00000083
|
||||
|
||||
/// <summary>The Media Next Track key.</summary>
|
||||
MediaNextTrack = 132, // 0x00000084
|
||||
|
||||
/// <summary>The Media Previous Track key.</summary>
|
||||
MediaPreviousTrack = 133, // 0x00000085
|
||||
|
||||
/// <summary>The Media Stop key.</summary>
|
||||
MediaStop = 134, // 0x00000086
|
||||
|
||||
/// <summary>The Media Play Pause key.</summary>
|
||||
MediaPlayPause = 135, // 0x00000087
|
||||
|
||||
/// <summary>The Launch Mail key.</summary>
|
||||
LaunchMail = 136, // 0x00000088
|
||||
|
||||
/// <summary>The Select Media key.</summary>
|
||||
SelectMedia = 137, // 0x00000089
|
||||
|
||||
/// <summary>The Launch Application1 key.</summary>
|
||||
LaunchApplication1 = 138, // 0x0000008A
|
||||
|
||||
/// <summary>The Launch Application2 key.</summary>
|
||||
LaunchApplication2 = 139, // 0x0000008B
|
||||
|
||||
/// <summary>The OEM Semicolon key.</summary>
|
||||
OemSemicolon = 140, // 0x0000008C
|
||||
|
||||
/// <summary>The OEM Addition key.</summary>
|
||||
OemPlus = 141, // 0x0000008D
|
||||
|
||||
/// <summary>The OEM Comma key.</summary>
|
||||
OemComma = 142, // 0x0000008E
|
||||
|
||||
/// <summary>The OEM Minus key.</summary>
|
||||
OemMinus = 143, // 0x0000008F
|
||||
|
||||
/// <summary>The OEM Period key.</summary>
|
||||
OemPeriod = 144, // 0x00000091
|
||||
|
||||
/// <summary>The OEM Question key.</summary>
|
||||
OemQuestion = 145, // 0x00000092
|
||||
|
||||
/// <summary>The OEM Tilde key.</summary>
|
||||
OemTilde = 146, // 0x00000092
|
||||
|
||||
/// <summary>The ABNT_C1 (Brazilian) key.</summary>
|
||||
AbntC1 = 147, // 0x00000093
|
||||
|
||||
/// <summary>The ABNT_C2 (Brazilian) key.</summary>
|
||||
AbntC2 = 148, // 0x00000095
|
||||
|
||||
/// <summary>The OEM Open Brackets key.</summary>
|
||||
OemOpenBrackets = 149, // 0x00000096
|
||||
|
||||
/// <summary>The OEM Pipe key.</summary>
|
||||
OemPipe = 150, // 0x00000096
|
||||
|
||||
/// <summary>The OEM Close Brackets key.</summary>
|
||||
OemCloseBrackets = 151, // 0x00000097
|
||||
|
||||
/// <summary>The OEM Quotes key.</summary>
|
||||
OemQuotes = 152, // 0x00000098
|
||||
|
||||
/// <summary>The OEM Backslash key.</summary>
|
||||
OemBackslash = 154, // 0x0000009A
|
||||
|
||||
/// <summary>A special key masking the real key being processed by an IME.</summary>
|
||||
ImeProcessed = 155, // 0x0000009B
|
||||
|
||||
/// <summary>A special key masking the real key being processed as a system key.</summary>
|
||||
System = 156, // 0x0000009C
|
||||
|
||||
/// <summary>The OEM ATTN key.</summary>
|
||||
OemAttn = 157, // 0x0000009D
|
||||
|
||||
/// <summary>The OEM FINISH key.</summary>
|
||||
OemFinish = 158, // 0x0000009E
|
||||
|
||||
/// <summary>The OEM COPY key.</summary>
|
||||
OemCopy = 159, // 0x0000009F
|
||||
|
||||
/// <summary>The OEM AUTO key.</summary>
|
||||
OemAuto = 160, // 0x000000A0
|
||||
|
||||
/// <summary>The OEM ENLW key.</summary>
|
||||
OemEnlw = 161, // 0x000000A1
|
||||
|
||||
/// <summary>The OEM BACKTAB key.</summary>
|
||||
OemBackTab = 162, // 0x000000A2
|
||||
|
||||
/// <summary>The ATTN key.</summary>
|
||||
Attn = 163, // 0x000000A3
|
||||
|
||||
/// <summary>The CRSEL key.</summary>
|
||||
CrSel = 164, // 0x000000A4
|
||||
|
||||
/// <summary>The EXSEL key.</summary>
|
||||
ExSel = 165, // 0x000000A5
|
||||
|
||||
/// <summary>The ERASE EOF key.</summary>
|
||||
EraseEof = 166, // 0x000000A6
|
||||
|
||||
/// <summary>The PLAY key.</summary>
|
||||
Play = 167, // 0x000000A7
|
||||
|
||||
/// <summary>The ZOOM key.</summary>
|
||||
Zoom = 168, // 0x000000A8
|
||||
|
||||
/// <summary>A constant reserved for future use.</summary>
|
||||
NoName = 169, // 0x000000A9
|
||||
|
||||
/// <summary>The PA1 key.</summary>
|
||||
Pa1 = 170, // 0x000000AA
|
||||
|
||||
/// <summary>The OEM Clear key.</summary>
|
||||
OemClear = 171, // 0x000000AB
|
||||
|
||||
/// <summary>The key is used with another key to create a single combined character.</summary>
|
||||
DeadCharProcessed = 172, // 0x000000AC,
|
||||
/// <summary>The 9 key on the numeric keypad.</summary>
|
||||
NumPad9,
|
||||
|
||||
/// <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,
|
||||
|
||||
/// <summary>The NumPad separator key (lower half of the "Add" key on some keyboards)</summary>
|
||||
NumPadSeparator,
|
||||
|
||||
/// <summary>The F1 key.</summary>
|
||||
F1,
|
||||
|
||||
/// <summary>The F2 key.</summary>
|
||||
F2,
|
||||
|
||||
/// <summary>The F3 key.</summary>
|
||||
F3,
|
||||
|
||||
/// <summary>The F4 key.</summary>
|
||||
F4,
|
||||
|
||||
/// <summary>The F5 key.</summary>
|
||||
F5,
|
||||
|
||||
/// <summary>The F6 key.</summary>
|
||||
F6,
|
||||
|
||||
/// <summary>The F7 key.</summary>
|
||||
F7,
|
||||
|
||||
/// <summary>The F8 key.</summary>
|
||||
F8,
|
||||
|
||||
/// <summary>The F9 key.</summary>
|
||||
F9,
|
||||
|
||||
/// <summary>The F10 key.</summary>
|
||||
F10,
|
||||
|
||||
/// <summary>The F11 key.</summary>
|
||||
F11,
|
||||
|
||||
/// <summary>The F12 key.</summary>
|
||||
F12,
|
||||
|
||||
/// <summary>The F13 key.</summary>
|
||||
F13,
|
||||
|
||||
/// <summary>The F14 key.</summary>
|
||||
F14,
|
||||
|
||||
/// <summary>The F15 key.</summary>
|
||||
F15,
|
||||
|
||||
/// <summary>The F16 key.</summary>
|
||||
F16,
|
||||
|
||||
/// <summary>The F17 key.</summary>
|
||||
F17,
|
||||
|
||||
/// <summary>The F18 key.</summary>
|
||||
F18,
|
||||
|
||||
/// <summary>The F19 key.</summary>
|
||||
F19,
|
||||
|
||||
/// <summary>The F20 key.</summary>
|
||||
F20,
|
||||
|
||||
/// <summary>The F21 key.</summary>
|
||||
F21,
|
||||
|
||||
/// <summary>The F22 key.</summary>
|
||||
F22,
|
||||
|
||||
/// <summary>The F23 key.</summary>
|
||||
F23,
|
||||
|
||||
/// <summary>The F24 key.</summary>
|
||||
F24,
|
||||
|
||||
/// <summary>The Scroll Lock key.</summary>
|
||||
ScrollLock,
|
||||
|
||||
/// <summary>The left Shift key.</summary>
|
||||
LeftShift,
|
||||
|
||||
/// <summary>The right Shift key.</summary>
|
||||
RightShift,
|
||||
|
||||
/// <summary>The left CTRL key.</summary>
|
||||
LeftCtrl,
|
||||
|
||||
/// <summary>The right CTRL key.</summary>
|
||||
RightCtrl,
|
||||
|
||||
/// <summary>The left ALT key.</summary>
|
||||
LeftAlt,
|
||||
|
||||
/// <summary>The right ALT key.</summary>
|
||||
RightAlt,
|
||||
|
||||
/// <summary>The Browser Back key.</summary>
|
||||
BrowserBack,
|
||||
|
||||
/// <summary>The Browser Forward key.</summary>
|
||||
BrowserForward,
|
||||
|
||||
/// <summary>The Browser Refresh key.</summary>
|
||||
BrowserRefresh,
|
||||
|
||||
/// <summary>The Browser Stop key.</summary>
|
||||
BrowserStop,
|
||||
|
||||
/// <summary>The Browser Search key.</summary>
|
||||
BrowserSearch,
|
||||
|
||||
/// <summary>The Browser Favorites key.</summary>
|
||||
BrowserFavorites,
|
||||
|
||||
/// <summary>The Browser Home key.</summary>
|
||||
BrowserHome,
|
||||
|
||||
/// <summary>The Volume Mute key.</summary>
|
||||
VolumeMute,
|
||||
|
||||
/// <summary>The Volume Down key.</summary>
|
||||
VolumeDown,
|
||||
|
||||
/// <summary>The Volume Up key.</summary>
|
||||
VolumeUp,
|
||||
|
||||
/// <summary>The Media Next Track key.</summary>
|
||||
MediaNextTrack,
|
||||
|
||||
/// <summary>The Media Previous Track key.</summary>
|
||||
MediaPreviousTrack,
|
||||
|
||||
/// <summary>The Media Stop key.</summary>
|
||||
MediaStop,
|
||||
|
||||
/// <summary>The Media Play Pause key.</summary>
|
||||
MediaPlayPause,
|
||||
|
||||
/// <summary>The Launch Mail key.</summary>
|
||||
LaunchMail,
|
||||
|
||||
/// <summary>The Select Media key.</summary>
|
||||
SelectMedia,
|
||||
|
||||
/// <summary>The Launch Application1 key.</summary>
|
||||
FileBrowser,
|
||||
|
||||
/// <summary>The Launch Application2 key.</summary>
|
||||
Calculator,
|
||||
|
||||
/// <summary>The Semicolon key.</summary>
|
||||
OemSemicolon,
|
||||
|
||||
/// <summary>The Addition key.</summary>
|
||||
OemPlus,
|
||||
|
||||
/// <summary>The Comma key.</summary>
|
||||
OemComma,
|
||||
|
||||
/// <summary>The Minus key.</summary>
|
||||
OemMinus,
|
||||
|
||||
/// <summary>The Period key.</summary>
|
||||
OemPeriod,
|
||||
|
||||
/// <summary>The Question key.</summary>
|
||||
OemQuestion,
|
||||
|
||||
/// <summary>The Tilde key.</summary>
|
||||
OemTilde,
|
||||
|
||||
/// <summary>The OEM Open Brackets key.</summary>
|
||||
OemOpenBrackets,
|
||||
|
||||
/// <summary>The OEM Close Brackets key.</summary>
|
||||
OemCloseBrackets,
|
||||
|
||||
/// <summary>The OEM Pipe key. The backslash key next to enter.</summary>
|
||||
OemPipe,
|
||||
|
||||
/// <summary>The OEM Quotes key.</summary>
|
||||
OemQuotes,
|
||||
|
||||
/// <summary>The OEM Backslash key. On iso, it's the key between left shift and Z</summary>
|
||||
OemBackslash,
|
||||
}
|
||||
@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace Artemis.Core.Services;
|
||||
@ -9,194 +10,186 @@ namespace Artemis.Core.Services;
|
||||
public static class InputKeyUtilities
|
||||
{
|
||||
/// <summary>
|
||||
/// A dictionary of mappings between <see cref="KeyboardKey" /> and <see cref="LedId" />
|
||||
/// Tries to convert a <see cref="KeyboardKey" /> to a <see cref="LedId" />.
|
||||
/// </summary>
|
||||
public static readonly Dictionary<KeyboardKey, LedId> KeyboardKeyLedIdMap = new()
|
||||
public static bool TryGetLedIdFromKeyboardKey(KeyboardKey key, out LedId ledId)
|
||||
{
|
||||
{KeyboardKey.None, LedId.Keyboard_Custom1},
|
||||
{KeyboardKey.Cancel, LedId.Keyboard_Custom2},
|
||||
{KeyboardKey.Back, LedId.Keyboard_Backspace},
|
||||
{KeyboardKey.Tab, LedId.Keyboard_Tab},
|
||||
{KeyboardKey.LineFeed, LedId.Keyboard_Custom3},
|
||||
{KeyboardKey.Clear, LedId.Keyboard_Custom4},
|
||||
{KeyboardKey.Enter, LedId.Keyboard_Enter},
|
||||
{KeyboardKey.Pause, LedId.Keyboard_PauseBreak},
|
||||
{KeyboardKey.CapsLock, LedId.Keyboard_CapsLock},
|
||||
{KeyboardKey.HangulMode, LedId.Keyboard_Custom4},
|
||||
{KeyboardKey.JunjaMode, LedId.Keyboard_Custom5},
|
||||
{KeyboardKey.FinalMode, LedId.Keyboard_Custom6},
|
||||
{KeyboardKey.HanjaMode, LedId.Keyboard_Custom7},
|
||||
{KeyboardKey.Escape, LedId.Keyboard_Escape},
|
||||
{KeyboardKey.ImeConvert, LedId.Keyboard_Custom8},
|
||||
{KeyboardKey.ImeNonConvert, LedId.Keyboard_Custom9},
|
||||
{KeyboardKey.ImeAccept, LedId.Keyboard_Custom10},
|
||||
{KeyboardKey.ImeModeChange, LedId.Keyboard_Custom11},
|
||||
{KeyboardKey.Space, LedId.Keyboard_Space},
|
||||
{KeyboardKey.PageUp, LedId.Keyboard_PageUp},
|
||||
{KeyboardKey.PageDown, LedId.Keyboard_PageDown},
|
||||
{KeyboardKey.End, LedId.Keyboard_End},
|
||||
{KeyboardKey.Home, LedId.Keyboard_Home},
|
||||
{KeyboardKey.Left, LedId.Keyboard_ArrowLeft},
|
||||
{KeyboardKey.Up, LedId.Keyboard_ArrowUp},
|
||||
{KeyboardKey.Right, LedId.Keyboard_ArrowRight},
|
||||
{KeyboardKey.Down, LedId.Keyboard_ArrowDown},
|
||||
{KeyboardKey.Select, LedId.Keyboard_Custom12},
|
||||
{KeyboardKey.Print, LedId.Keyboard_Custom13},
|
||||
{KeyboardKey.Execute, LedId.Keyboard_Custom14},
|
||||
{KeyboardKey.PrintScreen, LedId.Keyboard_PrintScreen},
|
||||
{KeyboardKey.Insert, LedId.Keyboard_Insert},
|
||||
{KeyboardKey.Delete, LedId.Keyboard_Delete},
|
||||
{KeyboardKey.Help, LedId.Keyboard_Custom15},
|
||||
{KeyboardKey.D0, LedId.Keyboard_0},
|
||||
{KeyboardKey.D1, LedId.Keyboard_1},
|
||||
{KeyboardKey.D2, LedId.Keyboard_2},
|
||||
{KeyboardKey.D3, LedId.Keyboard_3},
|
||||
{KeyboardKey.D4, LedId.Keyboard_4},
|
||||
{KeyboardKey.D5, LedId.Keyboard_5},
|
||||
{KeyboardKey.D6, LedId.Keyboard_6},
|
||||
{KeyboardKey.D7, LedId.Keyboard_7},
|
||||
{KeyboardKey.D8, LedId.Keyboard_8},
|
||||
{KeyboardKey.D9, LedId.Keyboard_9},
|
||||
{KeyboardKey.A, LedId.Keyboard_A},
|
||||
{KeyboardKey.B, LedId.Keyboard_B},
|
||||
{KeyboardKey.C, LedId.Keyboard_C},
|
||||
{KeyboardKey.D, LedId.Keyboard_D},
|
||||
{KeyboardKey.E, LedId.Keyboard_E},
|
||||
{KeyboardKey.F, LedId.Keyboard_F},
|
||||
{KeyboardKey.G, LedId.Keyboard_G},
|
||||
{KeyboardKey.H, LedId.Keyboard_H},
|
||||
{KeyboardKey.I, LedId.Keyboard_I},
|
||||
{KeyboardKey.J, LedId.Keyboard_J},
|
||||
{KeyboardKey.K, LedId.Keyboard_K},
|
||||
{KeyboardKey.L, LedId.Keyboard_L},
|
||||
{KeyboardKey.M, LedId.Keyboard_M},
|
||||
{KeyboardKey.N, LedId.Keyboard_N},
|
||||
{KeyboardKey.O, LedId.Keyboard_O},
|
||||
{KeyboardKey.P, LedId.Keyboard_P},
|
||||
{KeyboardKey.Q, LedId.Keyboard_Q},
|
||||
{KeyboardKey.R, LedId.Keyboard_R},
|
||||
{KeyboardKey.S, LedId.Keyboard_S},
|
||||
{KeyboardKey.T, LedId.Keyboard_T},
|
||||
{KeyboardKey.U, LedId.Keyboard_U},
|
||||
{KeyboardKey.V, LedId.Keyboard_V},
|
||||
{KeyboardKey.W, LedId.Keyboard_W},
|
||||
{KeyboardKey.X, LedId.Keyboard_X},
|
||||
{KeyboardKey.Y, LedId.Keyboard_Y},
|
||||
{KeyboardKey.Z, LedId.Keyboard_Z},
|
||||
{KeyboardKey.LWin, LedId.Keyboard_LeftGui},
|
||||
{KeyboardKey.RWin, LedId.Keyboard_RightGui},
|
||||
{KeyboardKey.Apps, LedId.Keyboard_Application},
|
||||
{KeyboardKey.Sleep, LedId.Keyboard_Custom16},
|
||||
{KeyboardKey.NumPad0, LedId.Keyboard_Num0},
|
||||
{KeyboardKey.NumPad1, LedId.Keyboard_Num1},
|
||||
{KeyboardKey.NumPad2, LedId.Keyboard_Num2},
|
||||
{KeyboardKey.NumPad3, LedId.Keyboard_Num3},
|
||||
{KeyboardKey.NumPad4, LedId.Keyboard_Num4},
|
||||
{KeyboardKey.NumPad5, LedId.Keyboard_Num5},
|
||||
{KeyboardKey.NumPad6, LedId.Keyboard_Num6},
|
||||
{KeyboardKey.NumPad7, LedId.Keyboard_Num7},
|
||||
{KeyboardKey.NumPad8, LedId.Keyboard_Num8},
|
||||
{KeyboardKey.NumPad9, LedId.Keyboard_Num9},
|
||||
{KeyboardKey.Multiply, LedId.Keyboard_NumAsterisk},
|
||||
{KeyboardKey.Add, LedId.Keyboard_NumPlus},
|
||||
{KeyboardKey.Separator, LedId.Keyboard_NumEnter}, // unverified
|
||||
{KeyboardKey.Subtract, LedId.Keyboard_NumMinus},
|
||||
{KeyboardKey.Decimal, LedId.Keyboard_NumPeriodAndDelete},
|
||||
{KeyboardKey.Divide, LedId.Keyboard_NumSlash},
|
||||
{KeyboardKey.F1, LedId.Keyboard_F1},
|
||||
{KeyboardKey.F2, LedId.Keyboard_F2},
|
||||
{KeyboardKey.F3, LedId.Keyboard_F3},
|
||||
{KeyboardKey.F4, LedId.Keyboard_F4},
|
||||
{KeyboardKey.F5, LedId.Keyboard_F5},
|
||||
{KeyboardKey.F6, LedId.Keyboard_F6},
|
||||
{KeyboardKey.F7, LedId.Keyboard_F7},
|
||||
{KeyboardKey.F8, LedId.Keyboard_F8},
|
||||
{KeyboardKey.F9, LedId.Keyboard_F9},
|
||||
{KeyboardKey.F10, LedId.Keyboard_F10},
|
||||
{KeyboardKey.F11, LedId.Keyboard_F11},
|
||||
{KeyboardKey.F12, LedId.Keyboard_F12},
|
||||
{KeyboardKey.F13, LedId.Keyboard_Custom17},
|
||||
{KeyboardKey.F14, LedId.Keyboard_Custom18},
|
||||
{KeyboardKey.F15, LedId.Keyboard_Custom19},
|
||||
{KeyboardKey.F16, LedId.Keyboard_Custom20},
|
||||
{KeyboardKey.F17, LedId.Keyboard_Custom21},
|
||||
{KeyboardKey.F18, LedId.Keyboard_Custom22},
|
||||
{KeyboardKey.F19, LedId.Keyboard_Custom23},
|
||||
{KeyboardKey.F20, LedId.Keyboard_Custom24},
|
||||
{KeyboardKey.F21, LedId.Keyboard_Custom25},
|
||||
{KeyboardKey.F22, LedId.Keyboard_Custom26},
|
||||
{KeyboardKey.F23, LedId.Keyboard_Custom27},
|
||||
{KeyboardKey.F24, LedId.Keyboard_Custom28},
|
||||
{KeyboardKey.NumLock, LedId.Keyboard_NumLock},
|
||||
{KeyboardKey.Scroll, LedId.Keyboard_ScrollLock},
|
||||
{KeyboardKey.LeftShift, LedId.Keyboard_LeftShift},
|
||||
{KeyboardKey.RightShift, LedId.Keyboard_RightShift},
|
||||
{KeyboardKey.LeftCtrl, LedId.Keyboard_LeftCtrl},
|
||||
{KeyboardKey.RightCtrl, LedId.Keyboard_RightCtrl},
|
||||
{KeyboardKey.LeftAlt, LedId.Keyboard_LeftAlt},
|
||||
{KeyboardKey.RightAlt, LedId.Keyboard_RightAlt},
|
||||
{KeyboardKey.BrowserBack, LedId.Keyboard_Custom29},
|
||||
{KeyboardKey.BrowserForward, LedId.Keyboard_Custom30},
|
||||
{KeyboardKey.BrowserRefresh, LedId.Keyboard_Custom31},
|
||||
{KeyboardKey.BrowserStop, LedId.Keyboard_Custom32},
|
||||
{KeyboardKey.BrowserSearch, LedId.Keyboard_Custom33},
|
||||
{KeyboardKey.BrowserFavorites, LedId.Keyboard_Custom34},
|
||||
{KeyboardKey.BrowserHome, LedId.Keyboard_Custom35},
|
||||
{KeyboardKey.VolumeMute, LedId.Keyboard_MediaMute},
|
||||
{KeyboardKey.VolumeDown, LedId.Keyboard_MediaVolumeDown},
|
||||
{KeyboardKey.VolumeUp, LedId.Keyboard_MediaVolumeUp},
|
||||
{KeyboardKey.MediaNextTrack, LedId.Keyboard_MediaNextTrack},
|
||||
{KeyboardKey.MediaPreviousTrack, LedId.Keyboard_MediaPreviousTrack},
|
||||
{KeyboardKey.MediaStop, LedId.Keyboard_MediaStop},
|
||||
{KeyboardKey.MediaPlayPause, LedId.Keyboard_MediaPlay},
|
||||
{KeyboardKey.LaunchMail, LedId.Keyboard_Custom36},
|
||||
{KeyboardKey.SelectMedia, LedId.Keyboard_Custom37},
|
||||
{KeyboardKey.LaunchApplication1, LedId.Keyboard_Custom38},
|
||||
{KeyboardKey.LaunchApplication2, LedId.Keyboard_Custom39},
|
||||
{KeyboardKey.OemSemicolon, LedId.Keyboard_SemicolonAndColon},
|
||||
{KeyboardKey.OemPlus, LedId.Keyboard_EqualsAndPlus},
|
||||
{KeyboardKey.OemMinus, LedId.Keyboard_MinusAndUnderscore},
|
||||
{KeyboardKey.OemComma, LedId.Keyboard_CommaAndLessThan},
|
||||
{KeyboardKey.OemPeriod, LedId.Keyboard_PeriodAndBiggerThan},
|
||||
{KeyboardKey.OemQuestion, LedId.Keyboard_SlashAndQuestionMark},
|
||||
{KeyboardKey.OemTilde, LedId.Keyboard_GraveAccentAndTilde},
|
||||
{KeyboardKey.AbntC1, LedId.Keyboard_Custom40},
|
||||
{KeyboardKey.AbntC2, LedId.Keyboard_Custom41},
|
||||
{KeyboardKey.OemOpenBrackets, LedId.Keyboard_BracketLeft},
|
||||
{KeyboardKey.OemPipe, LedId.Keyboard_Backslash},
|
||||
{KeyboardKey.OemCloseBrackets, LedId.Keyboard_BracketRight},
|
||||
{KeyboardKey.OemQuotes, LedId.Keyboard_ApostropheAndDoubleQuote},
|
||||
{KeyboardKey.OemBackslash, LedId.Keyboard_Custom42}, // unverified
|
||||
{KeyboardKey.ImeProcessed, LedId.Keyboard_Custom43},
|
||||
{KeyboardKey.System, LedId.Keyboard_Custom44},
|
||||
{KeyboardKey.OemAttn, LedId.Keyboard_Custom45},
|
||||
{KeyboardKey.OemFinish, LedId.Keyboard_Custom46},
|
||||
{KeyboardKey.OemCopy, LedId.Keyboard_Custom47},
|
||||
{KeyboardKey.OemAuto, LedId.Keyboard_Custom48},
|
||||
{KeyboardKey.OemEnlw, LedId.Keyboard_Custom49},
|
||||
{KeyboardKey.OemBackTab, LedId.Keyboard_Custom50},
|
||||
{KeyboardKey.Attn, LedId.Keyboard_Custom51},
|
||||
{KeyboardKey.CrSel, LedId.Keyboard_Custom52},
|
||||
{KeyboardKey.ExSel, LedId.Keyboard_Custom53},
|
||||
{KeyboardKey.EraseEof, LedId.Keyboard_Custom54},
|
||||
{KeyboardKey.Play, LedId.Keyboard_MediaPlay},
|
||||
{KeyboardKey.Zoom, LedId.Keyboard_Custom55},
|
||||
{KeyboardKey.NoName, LedId.Keyboard_Custom56},
|
||||
{KeyboardKey.Pa1, LedId.Keyboard_Custom57},
|
||||
{KeyboardKey.OemClear, LedId.Keyboard_Custom58},
|
||||
{KeyboardKey.DeadCharProcessed, LedId.Keyboard_Custom59},
|
||||
{KeyboardKey.NumPadEnter, LedId.Keyboard_NumEnter}
|
||||
};
|
||||
ledId = LedIdFromKeyboardKey(key);
|
||||
return ledId != LedId.Invalid;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A dictionary of mappings between <see cref="MouseButton" /> and <see cref="LedId" />
|
||||
/// Tries to convert a <see cref="MouseButton" /> to a <see cref="LedId" />.
|
||||
/// </summary>
|
||||
public static readonly Dictionary<MouseButton, LedId> MouseButtonLedIdMap = new()
|
||||
public static bool TryGetLedIdFromMouseButton(MouseButton button, out LedId ledId)
|
||||
{
|
||||
{MouseButton.Left, LedId.Mouse1},
|
||||
{MouseButton.Middle, LedId.Mouse2},
|
||||
{MouseButton.Right, LedId.Mouse3},
|
||||
{MouseButton.Button4, LedId.Mouse4},
|
||||
{MouseButton.Button5, LedId.Mouse5}
|
||||
};
|
||||
ledId = LedIdFromMouseButton(button);
|
||||
return ledId != LedId.Invalid;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="KeyboardKey" /> to a <see cref="LedId" />.
|
||||
/// </summary>
|
||||
public static LedId LedIdFromKeyboardKey(KeyboardKey key)
|
||||
{
|
||||
return key switch
|
||||
{
|
||||
KeyboardKey.None => LedId.Keyboard_Custom1,
|
||||
KeyboardKey.Backspace => LedId.Keyboard_Backspace,
|
||||
KeyboardKey.Tab => LedId.Keyboard_Tab,
|
||||
KeyboardKey.Clear => LedId.Keyboard_Custom4,
|
||||
KeyboardKey.Enter => LedId.Keyboard_Enter,
|
||||
KeyboardKey.PauseBreak => LedId.Keyboard_PauseBreak,
|
||||
KeyboardKey.CapsLock => LedId.Keyboard_CapsLock,
|
||||
KeyboardKey.Escape => LedId.Keyboard_Escape,
|
||||
KeyboardKey.Space => LedId.Keyboard_Space,
|
||||
KeyboardKey.PageUp => LedId.Keyboard_PageUp,
|
||||
KeyboardKey.PageDown => LedId.Keyboard_PageDown,
|
||||
KeyboardKey.End => LedId.Keyboard_End,
|
||||
KeyboardKey.Home => LedId.Keyboard_Home,
|
||||
KeyboardKey.ArrowLeft => LedId.Keyboard_ArrowLeft,
|
||||
KeyboardKey.ArrowUp => LedId.Keyboard_ArrowUp,
|
||||
KeyboardKey.ArrowRight => LedId.Keyboard_ArrowRight,
|
||||
KeyboardKey.ArrowDown => LedId.Keyboard_ArrowDown,
|
||||
KeyboardKey.PrintScreen => LedId.Keyboard_PrintScreen,
|
||||
KeyboardKey.Insert => LedId.Keyboard_Insert,
|
||||
KeyboardKey.Delete => LedId.Keyboard_Delete,
|
||||
KeyboardKey.D0 => LedId.Keyboard_0,
|
||||
KeyboardKey.D1 => LedId.Keyboard_1,
|
||||
KeyboardKey.D2 => LedId.Keyboard_2,
|
||||
KeyboardKey.D3 => LedId.Keyboard_3,
|
||||
KeyboardKey.D4 => LedId.Keyboard_4,
|
||||
KeyboardKey.D5 => LedId.Keyboard_5,
|
||||
KeyboardKey.D6 => LedId.Keyboard_6,
|
||||
KeyboardKey.D7 => LedId.Keyboard_7,
|
||||
KeyboardKey.D8 => LedId.Keyboard_8,
|
||||
KeyboardKey.D9 => LedId.Keyboard_9,
|
||||
KeyboardKey.A => LedId.Keyboard_A,
|
||||
KeyboardKey.B => LedId.Keyboard_B,
|
||||
KeyboardKey.C => LedId.Keyboard_C,
|
||||
KeyboardKey.D => LedId.Keyboard_D,
|
||||
KeyboardKey.E => LedId.Keyboard_E,
|
||||
KeyboardKey.F => LedId.Keyboard_F,
|
||||
KeyboardKey.G => LedId.Keyboard_G,
|
||||
KeyboardKey.H => LedId.Keyboard_H,
|
||||
KeyboardKey.I => LedId.Keyboard_I,
|
||||
KeyboardKey.J => LedId.Keyboard_J,
|
||||
KeyboardKey.K => LedId.Keyboard_K,
|
||||
KeyboardKey.L => LedId.Keyboard_L,
|
||||
KeyboardKey.M => LedId.Keyboard_M,
|
||||
KeyboardKey.N => LedId.Keyboard_N,
|
||||
KeyboardKey.O => LedId.Keyboard_O,
|
||||
KeyboardKey.P => LedId.Keyboard_P,
|
||||
KeyboardKey.Q => LedId.Keyboard_Q,
|
||||
KeyboardKey.R => LedId.Keyboard_R,
|
||||
KeyboardKey.S => LedId.Keyboard_S,
|
||||
KeyboardKey.T => LedId.Keyboard_T,
|
||||
KeyboardKey.U => LedId.Keyboard_U,
|
||||
KeyboardKey.V => LedId.Keyboard_V,
|
||||
KeyboardKey.W => LedId.Keyboard_W,
|
||||
KeyboardKey.X => LedId.Keyboard_X,
|
||||
KeyboardKey.Y => LedId.Keyboard_Y,
|
||||
KeyboardKey.Z => LedId.Keyboard_Z,
|
||||
KeyboardKey.LeftWin => LedId.Keyboard_LeftGui,
|
||||
KeyboardKey.RightWin => LedId.Keyboard_RightGui,
|
||||
KeyboardKey.Application => LedId.Keyboard_Application,
|
||||
KeyboardKey.Sleep => LedId.Keyboard_Custom16,
|
||||
KeyboardKey.NumPad0 => LedId.Keyboard_Num0,
|
||||
KeyboardKey.NumPad1 => LedId.Keyboard_Num1,
|
||||
KeyboardKey.NumPad2 => LedId.Keyboard_Num2,
|
||||
KeyboardKey.NumPad3 => LedId.Keyboard_Num3,
|
||||
KeyboardKey.NumPad4 => LedId.Keyboard_Num4,
|
||||
KeyboardKey.NumPad5 => LedId.Keyboard_Num5,
|
||||
KeyboardKey.NumPad6 => LedId.Keyboard_Num6,
|
||||
KeyboardKey.NumPad7 => LedId.Keyboard_Num7,
|
||||
KeyboardKey.NumPad8 => LedId.Keyboard_Num8,
|
||||
KeyboardKey.NumPad9 => LedId.Keyboard_Num9,
|
||||
KeyboardKey.NumPadMultiply => LedId.Keyboard_NumAsterisk,
|
||||
KeyboardKey.NumPadAdd => LedId.Keyboard_NumPlus,
|
||||
KeyboardKey.NumPadSeparator => LedId.Keyboard_NumEnter,
|
||||
KeyboardKey.NumPadSubtract => LedId.Keyboard_NumMinus,
|
||||
KeyboardKey.NumPadDecimal => LedId.Keyboard_NumPeriodAndDelete,
|
||||
KeyboardKey.NumPadDivide => LedId.Keyboard_NumSlash,
|
||||
KeyboardKey.F1 => LedId.Keyboard_F1,
|
||||
KeyboardKey.F2 => LedId.Keyboard_F2,
|
||||
KeyboardKey.F3 => LedId.Keyboard_F3,
|
||||
KeyboardKey.F4 => LedId.Keyboard_F4,
|
||||
KeyboardKey.F5 => LedId.Keyboard_F5,
|
||||
KeyboardKey.F6 => LedId.Keyboard_F6,
|
||||
KeyboardKey.F7 => LedId.Keyboard_F7,
|
||||
KeyboardKey.F8 => LedId.Keyboard_F8,
|
||||
KeyboardKey.F9 => LedId.Keyboard_F9,
|
||||
KeyboardKey.F10 => LedId.Keyboard_F10,
|
||||
KeyboardKey.F11 => LedId.Keyboard_F11,
|
||||
KeyboardKey.F12 => LedId.Keyboard_F12,
|
||||
KeyboardKey.F13 => LedId.Keyboard_Custom17,
|
||||
KeyboardKey.F14 => LedId.Keyboard_Custom18,
|
||||
KeyboardKey.F15 => LedId.Keyboard_Custom19,
|
||||
KeyboardKey.F16 => LedId.Keyboard_Custom20,
|
||||
KeyboardKey.F17 => LedId.Keyboard_Custom21,
|
||||
KeyboardKey.F18 => LedId.Keyboard_Custom22,
|
||||
KeyboardKey.F19 => LedId.Keyboard_Custom23,
|
||||
KeyboardKey.F20 => LedId.Keyboard_Custom24,
|
||||
KeyboardKey.F21 => LedId.Keyboard_Custom25,
|
||||
KeyboardKey.F22 => LedId.Keyboard_Custom26,
|
||||
KeyboardKey.F23 => LedId.Keyboard_Custom27,
|
||||
KeyboardKey.F24 => LedId.Keyboard_Custom28,
|
||||
KeyboardKey.NumLock => LedId.Keyboard_NumLock,
|
||||
KeyboardKey.ScrollLock => LedId.Keyboard_ScrollLock,
|
||||
KeyboardKey.LeftShift => LedId.Keyboard_LeftShift,
|
||||
KeyboardKey.RightShift => LedId.Keyboard_RightShift,
|
||||
KeyboardKey.LeftCtrl => LedId.Keyboard_LeftCtrl,
|
||||
KeyboardKey.RightCtrl => LedId.Keyboard_RightCtrl,
|
||||
KeyboardKey.LeftAlt => LedId.Keyboard_LeftAlt,
|
||||
KeyboardKey.RightAlt => LedId.Keyboard_RightAlt,
|
||||
KeyboardKey.BrowserBack => LedId.Keyboard_Custom29,
|
||||
KeyboardKey.BrowserForward => LedId.Keyboard_Custom30,
|
||||
KeyboardKey.BrowserRefresh => LedId.Keyboard_Custom31,
|
||||
KeyboardKey.BrowserStop => LedId.Keyboard_Custom32,
|
||||
KeyboardKey.BrowserSearch => LedId.Keyboard_Custom33,
|
||||
KeyboardKey.BrowserFavorites => LedId.Keyboard_Custom34,
|
||||
KeyboardKey.BrowserHome => LedId.Keyboard_Custom35,
|
||||
KeyboardKey.VolumeMute => LedId.Keyboard_MediaMute,
|
||||
KeyboardKey.VolumeDown => LedId.Keyboard_MediaVolumeDown,
|
||||
KeyboardKey.VolumeUp => LedId.Keyboard_MediaVolumeUp,
|
||||
KeyboardKey.MediaNextTrack => LedId.Keyboard_MediaNextTrack,
|
||||
KeyboardKey.MediaPreviousTrack => LedId.Keyboard_MediaPreviousTrack,
|
||||
KeyboardKey.MediaStop => LedId.Keyboard_MediaStop,
|
||||
KeyboardKey.MediaPlayPause => LedId.Keyboard_MediaPlay,
|
||||
KeyboardKey.LaunchMail => LedId.Keyboard_Custom36,
|
||||
KeyboardKey.SelectMedia => LedId.Keyboard_Custom37,
|
||||
KeyboardKey.FileBrowser => LedId.Keyboard_Custom38,
|
||||
KeyboardKey.Calculator => LedId.Keyboard_Custom39,
|
||||
KeyboardKey.OemSemicolon => LedId.Keyboard_SemicolonAndColon,
|
||||
KeyboardKey.OemPlus => LedId.Keyboard_EqualsAndPlus,
|
||||
KeyboardKey.OemMinus => LedId.Keyboard_MinusAndUnderscore,
|
||||
KeyboardKey.OemComma => LedId.Keyboard_CommaAndLessThan,
|
||||
KeyboardKey.OemPeriod => LedId.Keyboard_PeriodAndBiggerThan,
|
||||
KeyboardKey.OemQuestion => LedId.Keyboard_SlashAndQuestionMark,
|
||||
KeyboardKey.OemTilde => LedId.Keyboard_GraveAccentAndTilde,
|
||||
KeyboardKey.OemOpenBrackets => LedId.Keyboard_BracketLeft,
|
||||
KeyboardKey.OemPipe => LedId.Keyboard_Backslash,
|
||||
KeyboardKey.OemCloseBrackets => LedId.Keyboard_BracketRight,
|
||||
KeyboardKey.OemQuotes => LedId.Keyboard_ApostropheAndDoubleQuote,
|
||||
KeyboardKey.OemBackslash => LedId.Keyboard_NonUsBackslash,
|
||||
KeyboardKey.NumPadEnter => LedId.Keyboard_NumEnter,
|
||||
_ => LedId.Invalid
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="MouseButton" /> to a <see cref="LedId" />
|
||||
/// </summary>
|
||||
public static LedId LedIdFromMouseButton(MouseButton button)
|
||||
{
|
||||
return button switch
|
||||
{
|
||||
MouseButton.Left => LedId.Mouse1,
|
||||
MouseButton.Middle => LedId.Mouse2,
|
||||
MouseButton.Right => LedId.Mouse3,
|
||||
MouseButton.Button4 => LedId.Mouse4,
|
||||
MouseButton.Button5 => LedId.Mouse5,
|
||||
_ => LedId.Invalid
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -268,7 +268,14 @@ internal class InputService : IInputService
|
||||
return;
|
||||
|
||||
// Get the LED
|
||||
bool foundLedId = InputKeyUtilities.KeyboardKeyLedIdMap.TryGetValue(e.Key, out LedId ledId);
|
||||
bool foundLedId = InputKeyUtilities.TryGetLedIdFromKeyboardKey(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);
|
||||
@ -348,7 +355,7 @@ internal class InputService : IInputService
|
||||
else
|
||||
modifiers &= ~KeyboardModifierKey.Shift;
|
||||
}
|
||||
else if (key == KeyboardKey.LWin || key == KeyboardKey.RWin)
|
||||
else if (key == KeyboardKey.LeftWin || key == KeyboardKey.RightWin)
|
||||
{
|
||||
if (isDown)
|
||||
modifiers |= KeyboardModifierKey.Windows;
|
||||
@ -387,7 +394,7 @@ internal class InputService : IInputService
|
||||
|
||||
private void InputProviderOnMouseButtonDataReceived(object? sender, InputProviderMouseButtonEventArgs e)
|
||||
{
|
||||
bool foundLedId = InputKeyUtilities.MouseButtonLedIdMap.TryGetValue(e.Button, out LedId ledId);
|
||||
bool foundLedId = InputKeyUtilities.TryGetLedIdFromMouseButton(e.Button, out LedId ledId);
|
||||
ArtemisLed? led = null;
|
||||
if (foundLedId && e.Device != null)
|
||||
led = e.Device.Leds.FirstOrDefault(l => l.RgbLed.Id == ledId);
|
||||
|
||||
@ -29,6 +29,7 @@ public class ApplicationStateManager
|
||||
|
||||
Core.Utilities.ShutdownRequested += UtilitiesOnShutdownRequested;
|
||||
Core.Utilities.RestartRequested += UtilitiesOnRestartRequested;
|
||||
Core.Utilities.UpdateRequested += UtilitiesOnUpdateRequested;
|
||||
|
||||
// On OS shutdown dispose the IOC container just so device providers get a chance to clean up
|
||||
if (Application.Current?.ApplicationLifetime is IControlledApplicationLifetime controlledApplicationLifetime)
|
||||
@ -138,4 +139,35 @@ public class ApplicationStateManager
|
||||
|
||||
//todo
|
||||
}
|
||||
|
||||
private void UtilitiesOnUpdateRequested(object? sender, UpdateEventArgs e)
|
||||
{
|
||||
List<string> argsList = new(StartupArguments);
|
||||
if (e.Silent && !argsList.Contains("--minimized"))
|
||||
argsList.Add("--minimized");
|
||||
|
||||
// Retain startup arguments after update by providing them to the script
|
||||
string script = Path.Combine(Constants.UpdatingFolder, "installing", "Scripts", "update.sh");
|
||||
string source = $"\"{Path.Combine(Constants.UpdatingFolder, "installing")}\"";
|
||||
string destination = $"\"{Constants.ApplicationFolder}\"";
|
||||
string args = argsList.Any() ? string.Join(' ', argsList) : "";
|
||||
|
||||
RunScriptWithOutputFile(script, $"{source} {destination} {args}", Path.Combine(Constants.DataFolder, "update-log.txt"));
|
||||
|
||||
// Lets try a graceful shutdown, the script will kill if needed
|
||||
if (Application.Current?.ApplicationLifetime is IControlledApplicationLifetime controlledApplicationLifetime)
|
||||
Dispatcher.UIThread.Post(() => controlledApplicationLifetime.Shutdown());
|
||||
}
|
||||
|
||||
private static void RunScriptWithOutputFile(string script, string arguments, string outputFile)
|
||||
{
|
||||
ProcessStartInfo info = new()
|
||||
{
|
||||
Arguments = $"\"{script}\" {arguments} > \"{outputFile}\"",
|
||||
FileName = "/bin/bash",
|
||||
WindowStyle = ProcessWindowStyle.Hidden,
|
||||
CreateNoWindow = true,
|
||||
};
|
||||
Process.Start(info);
|
||||
}
|
||||
}
|
||||
@ -27,4 +27,8 @@
|
||||
<ProjectReference Include="..\Artemis.Core\Artemis.Core.csproj" />
|
||||
<ProjectReference Include="..\Artemis.UI\Artemis.UI.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Icons/**" CopyToOutputDirectory="PreserveNewest" />
|
||||
<Content Include="Scripts/**" CopyToOutputDirectory="PreserveNewest" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
BIN
src/Artemis.UI.Linux/Icons/128x128/apps/artemis.png
Normal file
BIN
src/Artemis.UI.Linux/Icons/128x128/apps/artemis.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.8 KiB |
BIN
src/Artemis.UI.Linux/Icons/16x16/apps/artemis.png
Normal file
BIN
src/Artemis.UI.Linux/Icons/16x16/apps/artemis.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 518 B |
BIN
src/Artemis.UI.Linux/Icons/256x256/apps/artemis.png
Normal file
BIN
src/Artemis.UI.Linux/Icons/256x256/apps/artemis.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
BIN
src/Artemis.UI.Linux/Icons/32x32/apps/artemis.png
Normal file
BIN
src/Artemis.UI.Linux/Icons/32x32/apps/artemis.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
BIN
src/Artemis.UI.Linux/Icons/48x48/apps/artemis.png
Normal file
BIN
src/Artemis.UI.Linux/Icons/48x48/apps/artemis.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
BIN
src/Artemis.UI.Linux/Icons/64x64/apps/artemis.png
Normal file
BIN
src/Artemis.UI.Linux/Icons/64x64/apps/artemis.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
56
src/Artemis.UI.Linux/Scripts/update.sh
Normal file
56
src/Artemis.UI.Linux/Scripts/update.sh
Normal file
@ -0,0 +1,56 @@
|
||||
#!/bin/bash
|
||||
|
||||
sourceDirectory=$1
|
||||
destinationDirectory=$2
|
||||
artemisArgs=$3
|
||||
|
||||
# Wait for up to 10 seconds for the Artemis process to exit
|
||||
i=0
|
||||
while [ $i -le 10 ]
|
||||
do
|
||||
if ! pgrep -x "Artemis.UI.Linux" > /dev/null
|
||||
then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
i=$((i+1))
|
||||
done
|
||||
|
||||
# If the Artemis process is still running, kill it
|
||||
if pgrep -x "Artemis.UI.Linux" > /dev/null
|
||||
then
|
||||
pkill -x "Artemis.UI.Linux"
|
||||
fi
|
||||
|
||||
# Check if the destination directory exists
|
||||
if [ ! -d "$destinationDirectory" ]
|
||||
then
|
||||
echo "Destination directory does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Clear the destination directory but don't remove it
|
||||
echo "Cleaning up old version where needed"
|
||||
rm -rf "${destinationDirectory:?}/"*
|
||||
|
||||
# Move the contents of the source directory to the destination directory
|
||||
echo "Installing new files"
|
||||
mv "$sourceDirectory"/* "$destinationDirectory"
|
||||
|
||||
# Remove the now empty source directory
|
||||
rmdir "$sourceDirectory"
|
||||
|
||||
# Ensure the executable is executable
|
||||
chmod +x "$destinationDirectory/Artemis.UI.Linux"
|
||||
|
||||
echo "Finished! Restarting Artemis"
|
||||
sleep 1
|
||||
|
||||
# When finished, start Artemis again
|
||||
|
||||
# quoting here breaks stuff, all arguments count as 1
|
||||
# shellcheck disable=SC2086
|
||||
"$destinationDirectory/Artemis.UI.Linux" $artemisArgs &
|
||||
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ public static class InputUtilities
|
||||
LinuxKeyboardKeyCodes.KEY_0 => KeyboardKey.D0,
|
||||
LinuxKeyboardKeyCodes.KEY_MINUS => KeyboardKey.OemMinus,
|
||||
LinuxKeyboardKeyCodes.KEY_EQUAL => KeyboardKey.OemPlus,
|
||||
LinuxKeyboardKeyCodes.KEY_BACKSPACE => KeyboardKey.Back,
|
||||
LinuxKeyboardKeyCodes.KEY_BACKSPACE => KeyboardKey.Backspace,
|
||||
LinuxKeyboardKeyCodes.KEY_TAB => KeyboardKey.Tab,
|
||||
LinuxKeyboardKeyCodes.KEY_Q => KeyboardKey.Q,
|
||||
LinuxKeyboardKeyCodes.KEY_W => KeyboardKey.W,
|
||||
@ -79,20 +79,20 @@ public static class InputUtilities
|
||||
LinuxKeyboardKeyCodes.KEY_F9 => KeyboardKey.F9,
|
||||
LinuxKeyboardKeyCodes.KEY_F10 => KeyboardKey.F10,
|
||||
LinuxKeyboardKeyCodes.KEY_NUMLOCK => KeyboardKey.NumLock,
|
||||
LinuxKeyboardKeyCodes.KEY_SCROLLLOCK => KeyboardKey.Scroll,
|
||||
LinuxKeyboardKeyCodes.KEY_SCROLLLOCK => KeyboardKey.ScrollLock,
|
||||
LinuxKeyboardKeyCodes.KEY_KP7 => KeyboardKey.NumPad7,
|
||||
LinuxKeyboardKeyCodes.KEY_KP8 => KeyboardKey.NumPad8,
|
||||
LinuxKeyboardKeyCodes.KEY_KP9 => KeyboardKey.NumPad9,
|
||||
LinuxKeyboardKeyCodes.KEY_KPMINUS => KeyboardKey.Subtract,
|
||||
LinuxKeyboardKeyCodes.KEY_KPMINUS => KeyboardKey.NumPadSubtract,
|
||||
LinuxKeyboardKeyCodes.KEY_KP4 => KeyboardKey.NumPad4,
|
||||
LinuxKeyboardKeyCodes.KEY_KP5 => KeyboardKey.NumPad5,
|
||||
LinuxKeyboardKeyCodes.KEY_KP6 => KeyboardKey.NumPad6,
|
||||
LinuxKeyboardKeyCodes.KEY_KPPLUS => KeyboardKey.Add,
|
||||
LinuxKeyboardKeyCodes.KEY_KPPLUS => KeyboardKey.NumPadAdd,
|
||||
LinuxKeyboardKeyCodes.KEY_KP1 => KeyboardKey.NumPad1,
|
||||
LinuxKeyboardKeyCodes.KEY_KP2 => KeyboardKey.NumPad2,
|
||||
LinuxKeyboardKeyCodes.KEY_KP3 => KeyboardKey.NumPad3,
|
||||
LinuxKeyboardKeyCodes.KEY_KP0 => KeyboardKey.NumPad0,
|
||||
LinuxKeyboardKeyCodes.KEY_KPDOT => KeyboardKey.Decimal,
|
||||
LinuxKeyboardKeyCodes.KEY_KPDOT => KeyboardKey.NumPadDecimal,
|
||||
// LinuxKeyboardKeyCodes.KEY_ZENKAKUHANKAKU => expr,
|
||||
// LinuxKeyboardKeyCodes.KEY_102ND => expr,
|
||||
LinuxKeyboardKeyCodes.KEY_F11 => KeyboardKey.F11,
|
||||
@ -106,17 +106,16 @@ public static class InputUtilities
|
||||
// LinuxKeyboardKeyCodes.KEY_KPJPCOMMA => expr,
|
||||
LinuxKeyboardKeyCodes.KEY_KPENTER => KeyboardKey.NumPadEnter,
|
||||
LinuxKeyboardKeyCodes.KEY_RIGHTCTRL => KeyboardKey.RightCtrl,
|
||||
LinuxKeyboardKeyCodes.KEY_KPSLASH => KeyboardKey.Divide,
|
||||
LinuxKeyboardKeyCodes.KEY_KPSLASH => KeyboardKey.NumPadDivide,
|
||||
LinuxKeyboardKeyCodes.KEY_SYSRQ => KeyboardKey.PrintScreen,
|
||||
LinuxKeyboardKeyCodes.KEY_RIGHTALT => KeyboardKey.RightAlt,
|
||||
LinuxKeyboardKeyCodes.KEY_LINEFEED => KeyboardKey.LineFeed,
|
||||
LinuxKeyboardKeyCodes.KEY_HOME => KeyboardKey.Home,
|
||||
LinuxKeyboardKeyCodes.KEY_UP => KeyboardKey.Up,
|
||||
LinuxKeyboardKeyCodes.KEY_UP => KeyboardKey.ArrowUp,
|
||||
LinuxKeyboardKeyCodes.KEY_PAGEUP => KeyboardKey.PageUp,
|
||||
LinuxKeyboardKeyCodes.KEY_LEFT => KeyboardKey.Left,
|
||||
LinuxKeyboardKeyCodes.KEY_RIGHT => KeyboardKey.Right,
|
||||
LinuxKeyboardKeyCodes.KEY_LEFT => KeyboardKey.ArrowLeft,
|
||||
LinuxKeyboardKeyCodes.KEY_RIGHT => KeyboardKey.ArrowRight,
|
||||
LinuxKeyboardKeyCodes.KEY_END => KeyboardKey.End,
|
||||
LinuxKeyboardKeyCodes.KEY_DOWN => KeyboardKey.Down,
|
||||
LinuxKeyboardKeyCodes.KEY_DOWN => KeyboardKey.ArrowDown,
|
||||
LinuxKeyboardKeyCodes.KEY_PAGEDOWN => KeyboardKey.PageDown,
|
||||
LinuxKeyboardKeyCodes.KEY_INSERT => KeyboardKey.Insert,
|
||||
LinuxKeyboardKeyCodes.KEY_DELETE => KeyboardKey.Delete,
|
||||
@ -127,15 +126,15 @@ public static class InputUtilities
|
||||
// LinuxKeyboardKeyCodes.KEY_POWER => KeyboardKey.power,
|
||||
LinuxKeyboardKeyCodes.KEY_KPEQUAL => KeyboardKey.NumPadEnter, //todo: ?
|
||||
// LinuxKeyboardKeyCodes.KEY_KPPLUSMINUS => KeyboardKey.numpad,
|
||||
LinuxKeyboardKeyCodes.KEY_PAUSE => KeyboardKey.Pause,
|
||||
LinuxKeyboardKeyCodes.KEY_PAUSE => KeyboardKey.PauseBreak,
|
||||
// LinuxKeyboardKeyCodes.KEY_SCALE => KeyboardKey.scal,
|
||||
// LinuxKeyboardKeyCodes.KEY_KPCOMMA => KeyboardKey.ke,
|
||||
// LinuxKeyboardKeyCodes.KEY_HANGEUL => expr,
|
||||
// LinuxKeyboardKeyCodes.KEY_HANJA => expr,
|
||||
// LinuxKeyboardKeyCodes.KEY_YEN => expr,
|
||||
LinuxKeyboardKeyCodes.KEY_LEFTMETA => KeyboardKey.LWin,
|
||||
LinuxKeyboardKeyCodes.KEY_RIGHTMETA => KeyboardKey.RWin,
|
||||
LinuxKeyboardKeyCodes.KEY_COMPOSE => KeyboardKey.Apps,
|
||||
LinuxKeyboardKeyCodes.KEY_LEFTMETA => KeyboardKey.LeftWin,
|
||||
LinuxKeyboardKeyCodes.KEY_RIGHTMETA => KeyboardKey.RightWin,
|
||||
LinuxKeyboardKeyCodes.KEY_COMPOSE => KeyboardKey.Application,
|
||||
LinuxKeyboardKeyCodes.KEY_STOP => KeyboardKey.MediaStop,
|
||||
// LinuxKeyboardKeyCodes.KEY_AGAIN => ,
|
||||
// LinuxKeyboardKeyCodes.KEY_PROPS => expr,
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Timers;
|
||||
@ -114,17 +114,21 @@ public class WindowsInputProvider : InputProvider
|
||||
|
||||
private void HandleKeyboardData(RawInputData data, RawInputKeyboardData keyboardData)
|
||||
{
|
||||
KeyboardKey key = InputUtilities.KeyFromVirtualKey(keyboardData.Keyboard.VirutalKey);
|
||||
KeyboardKey key = KeyboardKey.None;
|
||||
try
|
||||
{
|
||||
key = InputUtilities.CorrectVirtualKeyAndScanCode(keyboardData.Keyboard.VirutalKey, keyboardData.Keyboard.ScanCode, (uint)keyboardData.Keyboard.Flags);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.Error(e, "Failed to convert virtual key to Artemis key, please share this log with the developers. ScanCode: {scanCode} VK: {virtualKey} Flags: {flags}",
|
||||
keyboardData.Keyboard.ScanCode, keyboardData.Keyboard.VirutalKey, 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
|
||||
if (key == KeyboardKey.None)
|
||||
return;
|
||||
|
||||
// Right alt triggers LeftCtrl with a different scan code for some reason, ignore those
|
||||
if (key == KeyboardKey.LeftCtrl && keyboardData.Keyboard.ScanCode == 56)
|
||||
return;
|
||||
|
||||
string? identifier = data.Device?.DevicePath;
|
||||
|
||||
// Let the core know there is an identifier so it can store new identifications if applicable
|
||||
@ -142,23 +146,7 @@ public class WindowsInputProvider : InputProvider
|
||||
_logger.Warning(e, "Failed to retrieve input device by its identifier");
|
||||
}
|
||||
|
||||
// Duplicate keys with different positions can be identified by the LeftKey flag (even though its set of the key that's physically on the right)
|
||||
if (keyboardData.Keyboard.Flags == RawKeyboardFlags.KeyE0 || keyboardData.Keyboard.Flags == (RawKeyboardFlags.KeyE0 | RawKeyboardFlags.Up))
|
||||
{
|
||||
if (key == KeyboardKey.Enter)
|
||||
key = KeyboardKey.NumPadEnter;
|
||||
if (key == KeyboardKey.LeftCtrl)
|
||||
key = KeyboardKey.RightCtrl;
|
||||
if (key == KeyboardKey.LeftAlt)
|
||||
key = KeyboardKey.RightAlt;
|
||||
}
|
||||
|
||||
if (key == KeyboardKey.LeftShift && keyboardData.Keyboard.ScanCode == 54)
|
||||
key = KeyboardKey.RightShift;
|
||||
|
||||
bool isDown = keyboardData.Keyboard.Flags != RawKeyboardFlags.Up &&
|
||||
keyboardData.Keyboard.Flags != (RawKeyboardFlags.Up | RawKeyboardFlags.KeyE0) &&
|
||||
keyboardData.Keyboard.Flags != (RawKeyboardFlags.Up | RawKeyboardFlags.KeyE1);
|
||||
bool isDown = (keyboardData.Keyboard.Flags & RawKeyboardFlags.Up) == 0;
|
||||
|
||||
OnKeyboardDataReceived(device, key, isDown);
|
||||
UpdateToggleStatus();
|
||||
@ -169,7 +157,7 @@ public class WindowsInputProvider : InputProvider
|
||||
OnKeyboardToggleStatusReceived(new KeyboardToggleStatus(
|
||||
InputUtilities.IsKeyToggled(KeyboardKey.NumLock),
|
||||
InputUtilities.IsKeyToggled(KeyboardKey.CapsLock),
|
||||
InputUtilities.IsKeyToggled(KeyboardKey.Scroll)
|
||||
InputUtilities.IsKeyToggled(KeyboardKey.ScrollLock)
|
||||
));
|
||||
}
|
||||
|
||||
@ -227,39 +215,24 @@ public class WindowsInputProvider : InputProvider
|
||||
}
|
||||
|
||||
// Button presses
|
||||
MouseButton button = MouseButton.Left;
|
||||
bool isDown = false;
|
||||
|
||||
// Left
|
||||
if (DetermineMouseButton(mouseData, RawMouseButtonFlags.LeftButtonDown, RawMouseButtonFlags.LeftButtonUp, ref isDown))
|
||||
button = MouseButton.Left;
|
||||
// Middle
|
||||
else if (DetermineMouseButton(mouseData, RawMouseButtonFlags.MiddleButtonDown, RawMouseButtonFlags.MiddleButtonUp, ref isDown))
|
||||
button = MouseButton.Middle;
|
||||
// Right
|
||||
else if (DetermineMouseButton(mouseData, RawMouseButtonFlags.RightButtonDown, RawMouseButtonFlags.RightButtonUp, ref isDown))
|
||||
button = MouseButton.Right;
|
||||
// Button 4
|
||||
else if (DetermineMouseButton(mouseData, RawMouseButtonFlags.Button4Down, RawMouseButtonFlags.Button4Up, ref isDown))
|
||||
button = MouseButton.Button4;
|
||||
else if (DetermineMouseButton(mouseData, RawMouseButtonFlags.Button5Down, RawMouseButtonFlags.Button5Up, ref isDown))
|
||||
button = MouseButton.Button5;
|
||||
(MouseButton button, bool isDown) = mouseData.Mouse.Buttons switch
|
||||
{
|
||||
RawMouseButtonFlags.LeftButtonDown => (MouseButton.Left, true),
|
||||
RawMouseButtonFlags.LeftButtonUp => (MouseButton.Left, false),
|
||||
RawMouseButtonFlags.MiddleButtonDown => (MouseButton.Middle, true),
|
||||
RawMouseButtonFlags.MiddleButtonUp => (MouseButton.Middle, false),
|
||||
RawMouseButtonFlags.RightButtonDown => (MouseButton.Right, true),
|
||||
RawMouseButtonFlags.RightButtonUp => (MouseButton.Right, false),
|
||||
RawMouseButtonFlags.Button4Down => (MouseButton.Button4, true),
|
||||
RawMouseButtonFlags.Button4Up => (MouseButton.Button4, false),
|
||||
RawMouseButtonFlags.Button5Down => (MouseButton.Button5, true),
|
||||
RawMouseButtonFlags.Button5Up => (MouseButton.Button5, false),
|
||||
_ => (MouseButton.Left, false)
|
||||
};
|
||||
|
||||
OnMouseButtonDataReceived(device, button, isDown);
|
||||
}
|
||||
|
||||
private bool DetermineMouseButton(RawInputMouseData data, RawMouseButtonFlags downButton, RawMouseButtonFlags upButton, ref bool isDown)
|
||||
{
|
||||
if (data.Mouse.Buttons == downButton || data.Mouse.Buttons == upButton)
|
||||
{
|
||||
isDown = data.Mouse.Buttons == downButton;
|
||||
return true;
|
||||
}
|
||||
|
||||
isDown = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Native
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -68,7 +68,7 @@ public class InputMappingsTabViewModel : ActivatableViewModelBase
|
||||
return;
|
||||
|
||||
// Locate the original LED the same way the InputService did it, but supply false to Device.GetLed
|
||||
bool foundLedId = InputKeyUtilities.KeyboardKeyLedIdMap.TryGetValue(e.Key, out LedId ledId);
|
||||
bool foundLedId = InputKeyUtilities.TryGetLedIdFromKeyboardKey(e.Key, out LedId ledId);
|
||||
if (!foundLedId)
|
||||
return;
|
||||
ArtemisLed? artemisLed = Device.GetLed(ledId, false);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user