From f211307b9a7b6bdecd63881f0a028850fe35d260 Mon Sep 17 00:00:00 2001 From: Julien Lebosquain Date: Thu, 17 Aug 2023 14:53:15 +0200 Subject: [PATCH] Adjust PhysicalKey members naming --- .../Avalonia.Native/src/OSX/KeyTransform.mm | 131 ++++++---------- src/Avalonia.Base/Input/PhysicalKey.cs | 144 +++++++++--------- .../Input/PhysicalKeyExtensions.cs | 94 ++++++------ src/Avalonia.Native/avn.idl | 94 ++++++------ src/Avalonia.X11/X11KeyTransform.cs | 94 ++++++------ src/Browser/Avalonia.Browser/KeyInterop.cs | 122 +++++++-------- .../Avalonia.Win32/Input/KeyInterop.cs | 94 ++++++------ .../Input/KeyboardDeviceTests.cs | 6 +- .../HotKeyedControlsTests.cs | 2 +- .../TopLevelTests.cs | 2 +- .../Utils/HotKeyManagerTests.cs | 12 +- 11 files changed, 381 insertions(+), 414 deletions(-) diff --git a/native/Avalonia.Native/src/OSX/KeyTransform.mm b/native/Avalonia.Native/src/OSX/KeyTransform.mm index 86c62b20679..c9ec857a9a8 100644 --- a/native/Avalonia.Native/src/OSX/KeyTransform.mm +++ b/native/Avalonia.Native/src/OSX/KeyTransform.mm @@ -37,32 +37,32 @@ { 0x0A, AvnPhysicalKeyIntlBackslash, AvnKeyOem102, 0 }, { 0x5E, AvnPhysicalKeyIntlRo, AvnKeyOem102, 0 }, { 0x5D, AvnPhysicalKeyIntlYen, AvnKeyOem5, 0 }, - { 0x00, AvnPhysicalKeyKeyA, AvnKeyA, 'a' }, - { 0x0B, AvnPhysicalKeyKeyB, AvnKeyB, 'b' }, - { 0x08, AvnPhysicalKeyKeyC, AvnKeyC, 'c' }, - { 0x02, AvnPhysicalKeyKeyD, AvnKeyD, 'd' }, - { 0x0E, AvnPhysicalKeyKeyE, AvnKeyE, 'e' }, - { 0x03, AvnPhysicalKeyKeyF, AvnKeyF, 'f' }, - { 0x05, AvnPhysicalKeyKeyG, AvnKeyG, 'g' }, - { 0x04, AvnPhysicalKeyKeyH, AvnKeyH, 'h' }, - { 0x22, AvnPhysicalKeyKeyI, AvnKeyI, 'i' }, - { 0x26, AvnPhysicalKeyKeyJ, AvnKeyJ, 'j' }, - { 0x28, AvnPhysicalKeyKeyK, AvnKeyK, 'k' }, - { 0x25, AvnPhysicalKeyKeyL, AvnKeyL, 'l' }, - { 0x2E, AvnPhysicalKeyKeyM, AvnKeyM, 'm' }, - { 0x2D, AvnPhysicalKeyKeyN, AvnKeyN, 'n' }, - { 0x1F, AvnPhysicalKeyKeyO, AvnKeyO, 'o' }, - { 0x23, AvnPhysicalKeyKeyP, AvnKeyP, 'p' }, - { 0x0C, AvnPhysicalKeyKeyQ, AvnKeyQ, 'q' }, - { 0x0F, AvnPhysicalKeyKeyR, AvnKeyR, 'r' }, - { 0x01, AvnPhysicalKeyKeyS, AvnKeyS, 's' }, - { 0x11, AvnPhysicalKeyKeyT, AvnKeyT, 't' }, - { 0x20, AvnPhysicalKeyKeyU, AvnKeyU, 'u' }, - { 0x09, AvnPhysicalKeyKeyV, AvnKeyV, 'v' }, - { 0x0D, AvnPhysicalKeyKeyW, AvnKeyW, 'w' }, - { 0x07, AvnPhysicalKeyKeyX, AvnKeyX, 'x' }, - { 0x10, AvnPhysicalKeyKeyY, AvnKeyY, 'y' }, - { 0x06, AvnPhysicalKeyKeyZ, AvnKeyZ, 'z' }, + { 0x00, AvnPhysicalKeyA, AvnKeyA, 'a' }, + { 0x0B, AvnPhysicalKeyB, AvnKeyB, 'b' }, + { 0x08, AvnPhysicalKeyC, AvnKeyC, 'c' }, + { 0x02, AvnPhysicalKeyD, AvnKeyD, 'd' }, + { 0x0E, AvnPhysicalKeyE, AvnKeyE, 'e' }, + { 0x03, AvnPhysicalKeyF, AvnKeyF, 'f' }, + { 0x05, AvnPhysicalKeyG, AvnKeyG, 'g' }, + { 0x04, AvnPhysicalKeyH, AvnKeyH, 'h' }, + { 0x22, AvnPhysicalKeyI, AvnKeyI, 'i' }, + { 0x26, AvnPhysicalKeyJ, AvnKeyJ, 'j' }, + { 0x28, AvnPhysicalKeyK, AvnKeyK, 'k' }, + { 0x25, AvnPhysicalKeyL, AvnKeyL, 'l' }, + { 0x2E, AvnPhysicalKeyM, AvnKeyM, 'm' }, + { 0x2D, AvnPhysicalKeyN, AvnKeyN, 'n' }, + { 0x1F, AvnPhysicalKeyO, AvnKeyO, 'o' }, + { 0x23, AvnPhysicalKeyP, AvnKeyP, 'p' }, + { 0x0C, AvnPhysicalKeyQ, AvnKeyQ, 'q' }, + { 0x0F, AvnPhysicalKeyR, AvnKeyR, 'r' }, + { 0x01, AvnPhysicalKeyS, AvnKeyS, 's' }, + { 0x11, AvnPhysicalKeyT, AvnKeyT, 't' }, + { 0x20, AvnPhysicalKeyU, AvnKeyU, 'u' }, + { 0x09, AvnPhysicalKeyV, AvnKeyV, 'v' }, + { 0x0D, AvnPhysicalKeyW, AvnKeyW, 'w' }, + { 0x07, AvnPhysicalKeyX, AvnKeyX, 'x' }, + { 0x10, AvnPhysicalKeyY, AvnKeyY, 'y' }, + { 0x06, AvnPhysicalKeyZ, AvnKeyZ, 'z' }, { 0x1B, AvnPhysicalKeyMinus, AvnKeyOemMinus, '-' }, { 0x2F, AvnPhysicalKeyPeriod, AvnKeyOemPeriod, '.' }, { 0x27, AvnPhysicalKeyQuote, AvnKeyOem7, '\'' }, @@ -110,27 +110,27 @@ // Numpad Section { 0x47, AvnPhysicalKeyNumLock, AvnKeyClear, kClearCharCode }, - { 0x52, AvnPhysicalKeyNumpad0, AvnKeyNumPad0, '0' }, - { 0x53, AvnPhysicalKeyNumpad1, AvnKeyNumPad1, '1' }, - { 0x54, AvnPhysicalKeyNumpad2, AvnKeyNumPad2, '2' }, - { 0x55, AvnPhysicalKeyNumpad3, AvnKeyNumPad3, '3' }, - { 0x56, AvnPhysicalKeyNumpad4, AvnKeyNumPad4, '4' }, - { 0x57, AvnPhysicalKeyNumpad5, AvnKeyNumPad5, '5' }, - { 0x58, AvnPhysicalKeyNumpad6, AvnKeyNumPad6, '6' }, - { 0x59, AvnPhysicalKeyNumpad7, AvnKeyNumPad7, '7' }, - { 0x5B, AvnPhysicalKeyNumpad8, AvnKeyNumPad8, '8' }, - { 0x5C, AvnPhysicalKeyNumpad9, AvnKeyNumPad9, '9' }, - { 0x45, AvnPhysicalKeyNumpadAdd, AvnKeyAdd, '+' }, - //{ , AvnPhysicalKeyNumpadClear, 0 }, - { 0x5F, AvnPhysicalKeyNumpadComma, AvnKeyAbntC2, 0 }, - { 0x41, AvnPhysicalKeyNumpadDecimal, AvnKeyDecimal, '.' }, - { 0x4B, AvnPhysicalKeyNumpadDivide, AvnKeyDivide, '/' }, - { 0x4C, AvnPhysicalKeyNumpadEnter, AvnKeyEnter, kReturnCharCode }, - { 0x51, AvnPhysicalKeyNumpadEqual, AvnKeyOemPlus, '=' }, - { 0x43, AvnPhysicalKeyNumpadMultiply, AvnKeyMultiply, '*' }, - //{ , AvnPhysicalKeyNumpadParenLeft, 0 }, - //{ , AvnPhysicalKeyNumpadParenRight, 0 }, - { 0x4E, AvnPhysicalKeyNumpadSubtract, AvnKeySubtract, '-' }, + { 0x52, AvnPhysicalKeyNumPad0, AvnKeyNumPad0, '0' }, + { 0x53, AvnPhysicalKeyNumPad1, AvnKeyNumPad1, '1' }, + { 0x54, AvnPhysicalKeyNumPad2, AvnKeyNumPad2, '2' }, + { 0x55, AvnPhysicalKeyNumPad3, AvnKeyNumPad3, '3' }, + { 0x56, AvnPhysicalKeyNumPad4, AvnKeyNumPad4, '4' }, + { 0x57, AvnPhysicalKeyNumPad5, AvnKeyNumPad5, '5' }, + { 0x58, AvnPhysicalKeyNumPad6, AvnKeyNumPad6, '6' }, + { 0x59, AvnPhysicalKeyNumPad7, AvnKeyNumPad7, '7' }, + { 0x5B, AvnPhysicalKeyNumPad8, AvnKeyNumPad8, '8' }, + { 0x5C, AvnPhysicalKeyNumPad9, AvnKeyNumPad9, '9' }, + { 0x45, AvnPhysicalKeyNumPadAdd, AvnKeyAdd, '+' }, + //{ , AvnPhysicalKeyNumPadClear, 0 }, + { 0x5F, AvnPhysicalKeyNumPadComma, AvnKeyAbntC2, 0 }, + { 0x41, AvnPhysicalKeyNumPadDecimal, AvnKeyDecimal, '.' }, + { 0x4B, AvnPhysicalKeyNumPadDivide, AvnKeyDivide, '/' }, + { 0x4C, AvnPhysicalKeyNumPadEnter, AvnKeyEnter, kReturnCharCode }, + { 0x51, AvnPhysicalKeyNumPadEqual, AvnKeyOemPlus, '=' }, + { 0x43, AvnPhysicalKeyNumPadMultiply, AvnKeyMultiply, '*' }, + //{ , AvnPhysicalKeyNumPadParenLeft, 0 }, + //{ , AvnPhysicalKeyNumPadParenRight, 0 }, + { 0x4E, AvnPhysicalKeyNumPadSubtract, AvnKeySubtract, '-' }, // Function Section { 0x35, AvnPhysicalKeyEscape, AvnKeyEscape, kEscapeCharCode }, @@ -372,41 +372,8 @@ static PhysicalKeyArray BuildPhysicalKeyFromScanCode() static bool IsNumpadOrNumericKey(AvnPhysicalKey physicalKey) { - switch (physicalKey) - { - case AvnPhysicalKeyDigit0: - case AvnPhysicalKeyDigit1: - case AvnPhysicalKeyDigit2: - case AvnPhysicalKeyDigit3: - case AvnPhysicalKeyDigit4: - case AvnPhysicalKeyDigit5: - case AvnPhysicalKeyDigit6: - case AvnPhysicalKeyDigit7: - case AvnPhysicalKeyDigit8: - case AvnPhysicalKeyDigit9: - case AvnPhysicalKeyNumLock: - case AvnPhysicalKeyNumpad0: - case AvnPhysicalKeyNumpad1: - case AvnPhysicalKeyNumpad2: - case AvnPhysicalKeyNumpad3: - case AvnPhysicalKeyNumpad4: - case AvnPhysicalKeyNumpad5: - case AvnPhysicalKeyNumpad6: - case AvnPhysicalKeyNumpad7: - case AvnPhysicalKeyNumpad8: - case AvnPhysicalKeyNumpad9: - case AvnPhysicalKeyNumpadAdd: - case AvnPhysicalKeyNumpadComma: - case AvnPhysicalKeyNumpadDecimal: - case AvnPhysicalKeyNumpadDivide: - case AvnPhysicalKeyNumpadEnter: - case AvnPhysicalKeyNumpadEqual: - case AvnPhysicalKeyNumpadMultiply: - case AvnPhysicalKeyNumpadSubtract: - return true; - default: - return false; - } + return (physicalKey >= AvnPhysicalKeyDigit0 && physicalKey <= AvnPhysicalKeyDigit9) + || (physicalKey >= AvnPhysicalKeyNumLock && physicalKey <= AvnPhysicalKeyNumPadSubtract); } AvnPhysicalKey PhysicalKeyFromScanCode(uint16_t scanCode) diff --git a/src/Avalonia.Base/Input/PhysicalKey.cs b/src/Avalonia.Base/Input/PhysicalKey.cs index f0a44bef8ef..029133324c1 100644 --- a/src/Avalonia.Base/Input/PhysicalKey.cs +++ b/src/Avalonia.Base/Input/PhysicalKey.cs @@ -128,137 +128,137 @@ public enum PhysicalKey /// a on a US keyboard. /// q on an AZERTY (e.g., French) keyboard. /// - KeyA = 20, + A = 20, /// /// b on a US keyboard. /// - KeyB = 21, + B = 21, /// /// c on a US keyboard. /// - KeyC = 22, + C = 22, /// /// d on a US keyboard. /// - KeyD = 23, + D = 23, /// /// e on a US keyboard. /// - KeyE = 24, + E = 24, /// /// f on a US keyboard. /// - KeyF = 25, + F = 25, /// /// g on a US keyboard. /// - KeyG = 26, + G = 26, /// /// h on a US keyboard. /// - KeyH = 27, + H = 27, /// /// i on a US keyboard. /// - KeyI = 28, + I = 28, /// /// j on a US keyboard. /// - KeyJ = 29, + J = 29, /// /// k on a US keyboard. /// - KeyK = 30, + K = 30, /// /// l on a US keyboard. /// - KeyL = 31, + L = 31, /// /// m on a US keyboard. /// - KeyM = 32, + M = 32, /// /// n on a US keyboard. /// - KeyN = 33, + N = 33, /// /// o on a US keyboard. /// - KeyO = 34, + O = 34, /// /// p on a US keyboard. /// - KeyP = 35, + P = 35, /// /// q on a US keyboard. /// a on an AZERTY (e.g., French) keyboard. /// - KeyQ = 36, + Q = 36, /// /// r on a US keyboard. /// - KeyR = 37, + R = 37, /// /// s on a US keyboard. /// - KeyS = 38, + S = 38, /// /// t on a US keyboard. /// - KeyT = 39, + T = 39, /// /// u on a US keyboard. /// - KeyU = 40, + U = 40, /// /// v on a US keyboard. /// - KeyV = 41, + V = 41, /// /// w on a US keyboard. /// z on an AZERTY (e.g., French) keyboard. /// - KeyW = 42, + W = 42, /// /// x on a US keyboard. /// - KeyX = 43, + X = 43, /// /// y on a US keyboard. /// z on a QWERTZ (e.g., German) keyboard. /// - KeyY = 44, + Y = 44, /// /// z on a US keyboard. /// w on an AZERTY (e.g., French) keyboard. /// y on a QWERTZ (e.g., German) keyboard. /// - KeyZ = 45, + Z = 45, /// /// -_ on a US keyboard. @@ -476,137 +476,137 @@ public enum PhysicalKey ArrowUp = 83, - // ############## - // Numpad Section - // ############## + // ###################### + // Numeric Keypad Section + // ###################### /// - /// Numpad Num Lock. + /// Numeric keypad Num Lock. /// On the Mac, this is used for the numpad Clear key. /// NumLock = 84, /// - /// Numpad 0 Ins on a keyboard. + /// Numeric keypad 0 Ins on a keyboard. /// 0 on a phone or remote control. /// - Numpad0 = 85, + NumPad0 = 85, /// - /// Numpad 1 End on a keyboard. + /// Numeric keypad 1 End on a keyboard. /// 1 or 1 QZ on a phone or remote control. /// - Numpad1 = 86, + NumPad1 = 86, /// - /// Numpad 2 ↓ on a keyboard. + /// Numeric keypad 2 ↓ on a keyboard. /// 2 ABC on a phone or remote control. /// - Numpad2 = 87, + NumPad2 = 87, /// - /// Numpad 3 PgDn on a keyboard. + /// Numeric keypad 3 PgDn on a keyboard. /// 3 DEF on a phone or remote control. /// - Numpad3 = 88, + NumPad3 = 88, /// - /// Numpad 4 ← on a keyboard. + /// Numeric keypad 4 ← on a keyboard. /// 4 GHI on a phone or remote control. /// - Numpad4 = 89, + NumPad4 = 89, /// - /// Numpad 5 on a keyboard. + /// Numeric keypad 5 on a keyboard. /// 5 JKL on a phone or remote control. /// - Numpad5 = 90, + NumPad5 = 90, /// - /// Numpad 6 → on a keyboard. + /// Numeric keypad 6 → on a keyboard. /// 6 MNO on a phone or remote control. /// - Numpad6 = 91, + NumPad6 = 91, /// - /// Numpad 7 Home on a keyboard. + /// Numeric keypad 7 Home on a keyboard. /// 7 PQRS or 7 PRS on a phone or remote control. /// - Numpad7 = 92, + NumPad7 = 92, /// - /// Numpad 8 ↑ on a keyboard. + /// Numeric keypad 8 ↑ on a keyboard. /// 8 TUV on a phone or remote control. /// - Numpad8 = 93, + NumPad8 = 93, /// - /// Numpad 9 PgUp on a keyboard. + /// Numeric keypad 9 PgUp on a keyboard. /// 9 WXYZ or 9 WXY on a phone or remote control. /// - Numpad9 = 94, + NumPad9 = 94, /// - /// Numpad +. + /// Numeric keypad +. /// - NumpadAdd = 95, + NumPadAdd = 95, /// - /// Numpad C or AC (All Clear). + /// Numeric keypad C or AC (All Clear). /// Also for use with numpads that have a Clear key that is separate from the NumLock key. /// On the Mac, the numpad Clear key is . /// - NumpadClear = 96, + NumPadClear = 96, /// - /// Numpad , (thousands separator). + /// Numeric keypad , (thousands separator). /// For locales where the thousands separator is a "." (e.g., Brazil), this key may generate a .. /// - NumpadComma = 97, + NumPadComma = 97, /// - /// Numpad . Del. + /// Numeric keypad . Del. /// For locales where the decimal separator is "," (e.g., Brazil), this key may generate a ,. /// - NumpadDecimal = 98, + NumPadDecimal = 98, /// - /// Numpad /. + /// Numeric keypad /. /// - NumpadDivide = 99, + NumPadDivide = 99, /// - /// Numpad Enter. + /// Numeric keypad Enter. /// - NumpadEnter = 100, + NumPadEnter = 100, /// - /// Numpad =. + /// Numeric keypad =. /// - NumpadEqual = 101, + NumPadEqual = 101, /// - /// Numpad * on a keyboard. + /// Numeric keypad * on a keyboard. /// For use with numpads that provide mathematical operations (+, -, * and /). /// - NumpadMultiply = 102, + NumPadMultiply = 102, /// - /// Numpad (. + /// Numeric keypad (. /// Found on the Microsoft Natural Keyboard. /// - NumpadParenLeft = 103, + NumPadParenLeft = 103, /// - /// Numpad ). + /// Numeric keypad ). /// Found on the Microsoft Natural Keyboard. /// - NumpadParenRight = 104, + NumPadParenRight = 104, /// - /// Numpad -. + /// Numeric keypad -. /// - NumpadSubtract = 105, + NumPadSubtract = 105, // ################ diff --git a/src/Avalonia.Base/Input/PhysicalKeyExtensions.cs b/src/Avalonia.Base/Input/PhysicalKeyExtensions.cs index 4a6a191b386..46a2bc87a60 100644 --- a/src/Avalonia.Base/Input/PhysicalKeyExtensions.cs +++ b/src/Avalonia.Base/Input/PhysicalKeyExtensions.cs @@ -35,32 +35,32 @@ public static Key ToQwertyKey(this PhysicalKey physicalKey) PhysicalKey.IntlBackslash => Key.Oem102, PhysicalKey.IntlRo => Key.Oem102, PhysicalKey.IntlYen => Key.Oem5, - PhysicalKey.KeyA => Key.A, - PhysicalKey.KeyB => Key.B, - PhysicalKey.KeyC => Key.C, - PhysicalKey.KeyD => Key.D, - PhysicalKey.KeyE => Key.E, - PhysicalKey.KeyF => Key.F, - PhysicalKey.KeyG => Key.G, - PhysicalKey.KeyH => Key.H, - PhysicalKey.KeyI => Key.I, - PhysicalKey.KeyJ => Key.J, - PhysicalKey.KeyK => Key.K, - PhysicalKey.KeyL => Key.L, - PhysicalKey.KeyM => Key.M, - PhysicalKey.KeyN => Key.N, - PhysicalKey.KeyO => Key.O, - PhysicalKey.KeyP => Key.P, - PhysicalKey.KeyQ => Key.Q, - PhysicalKey.KeyR => Key.R, - PhysicalKey.KeyS => Key.S, - PhysicalKey.KeyT => Key.T, - PhysicalKey.KeyU => Key.U, - PhysicalKey.KeyV => Key.V, - PhysicalKey.KeyW => Key.W, - PhysicalKey.KeyX => Key.X, - PhysicalKey.KeyY => Key.Y, - PhysicalKey.KeyZ => Key.Z, + PhysicalKey.A => Key.A, + PhysicalKey.B => Key.B, + PhysicalKey.C => Key.C, + PhysicalKey.D => Key.D, + PhysicalKey.E => Key.E, + PhysicalKey.F => Key.F, + PhysicalKey.G => Key.G, + PhysicalKey.H => Key.H, + PhysicalKey.I => Key.I, + PhysicalKey.J => Key.J, + PhysicalKey.K => Key.K, + PhysicalKey.L => Key.L, + PhysicalKey.M => Key.M, + PhysicalKey.N => Key.N, + PhysicalKey.O => Key.O, + PhysicalKey.P => Key.P, + PhysicalKey.Q => Key.Q, + PhysicalKey.R => Key.R, + PhysicalKey.S => Key.S, + PhysicalKey.T => Key.T, + PhysicalKey.U => Key.U, + PhysicalKey.V => Key.V, + PhysicalKey.W => Key.W, + PhysicalKey.X => Key.X, + PhysicalKey.Y => Key.Y, + PhysicalKey.Z => Key.Z, PhysicalKey.Minus => Key.OemMinus, PhysicalKey.Period => Key.OemPeriod, PhysicalKey.Quote => Key.Oem7, @@ -108,27 +108,27 @@ public static Key ToQwertyKey(this PhysicalKey physicalKey) // Numpad Section PhysicalKey.NumLock => Key.NumLock, - PhysicalKey.Numpad0 => Key.NumPad0, - PhysicalKey.Numpad1 => Key.NumPad1, - PhysicalKey.Numpad2 => Key.NumPad2, - PhysicalKey.Numpad3 => Key.NumPad3, - PhysicalKey.Numpad4 => Key.NumPad4, - PhysicalKey.Numpad5 => Key.NumPad5, - PhysicalKey.Numpad6 => Key.NumPad6, - PhysicalKey.Numpad7 => Key.NumPad7, - PhysicalKey.Numpad8 => Key.NumPad8, - PhysicalKey.Numpad9 => Key.NumPad9, - PhysicalKey.NumpadAdd => Key.Add, - PhysicalKey.NumpadClear => Key.Clear, - PhysicalKey.NumpadComma => Key.AbntC2, - PhysicalKey.NumpadDecimal => Key.Decimal, - PhysicalKey.NumpadDivide => Key.Divide, - PhysicalKey.NumpadEnter => Key.Enter, - PhysicalKey.NumpadEqual => Key.OemPlus, - PhysicalKey.NumpadMultiply => Key.Multiply, - PhysicalKey.NumpadParenLeft => Key.Oem4, - PhysicalKey.NumpadParenRight => Key.Oem6, - PhysicalKey.NumpadSubtract => Key.Subtract, + PhysicalKey.NumPad0 => Key.NumPad0, + PhysicalKey.NumPad1 => Key.NumPad1, + PhysicalKey.NumPad2 => Key.NumPad2, + PhysicalKey.NumPad3 => Key.NumPad3, + PhysicalKey.NumPad4 => Key.NumPad4, + PhysicalKey.NumPad5 => Key.NumPad5, + PhysicalKey.NumPad6 => Key.NumPad6, + PhysicalKey.NumPad7 => Key.NumPad7, + PhysicalKey.NumPad8 => Key.NumPad8, + PhysicalKey.NumPad9 => Key.NumPad9, + PhysicalKey.NumPadAdd => Key.Add, + PhysicalKey.NumPadClear => Key.Clear, + PhysicalKey.NumPadComma => Key.AbntC2, + PhysicalKey.NumPadDecimal => Key.Decimal, + PhysicalKey.NumPadDivide => Key.Divide, + PhysicalKey.NumPadEnter => Key.Enter, + PhysicalKey.NumPadEqual => Key.OemPlus, + PhysicalKey.NumPadMultiply => Key.Multiply, + PhysicalKey.NumPadParenLeft => Key.Oem4, + PhysicalKey.NumPadParenRight => Key.Oem6, + PhysicalKey.NumPadSubtract => Key.Subtract, // Function Section PhysicalKey.Escape => Key.Escape, diff --git a/src/Avalonia.Native/avn.idl b/src/Avalonia.Native/avn.idl index 7db8f5ee9dc..fd0b41e2e37 100644 --- a/src/Avalonia.Native/avn.idl +++ b/src/Avalonia.Native/avn.idl @@ -240,32 +240,32 @@ enum AvnPhysicalKey AvnPhysicalKeyIntlBackslash = 17, AvnPhysicalKeyIntlRo = 18, AvnPhysicalKeyIntlYen = 19, - AvnPhysicalKeyKeyA = 20, - AvnPhysicalKeyKeyB = 21, - AvnPhysicalKeyKeyC = 22, - AvnPhysicalKeyKeyD = 23, - AvnPhysicalKeyKeyE = 24, - AvnPhysicalKeyKeyF = 25, - AvnPhysicalKeyKeyG = 26, - AvnPhysicalKeyKeyH = 27, - AvnPhysicalKeyKeyI = 28, - AvnPhysicalKeyKeyJ = 29, - AvnPhysicalKeyKeyK = 30, - AvnPhysicalKeyKeyL = 31, - AvnPhysicalKeyKeyM = 32, - AvnPhysicalKeyKeyN = 33, - AvnPhysicalKeyKeyO = 34, - AvnPhysicalKeyKeyP = 35, - AvnPhysicalKeyKeyQ = 36, - AvnPhysicalKeyKeyR = 37, - AvnPhysicalKeyKeyS = 38, - AvnPhysicalKeyKeyT = 39, - AvnPhysicalKeyKeyU = 40, - AvnPhysicalKeyKeyV = 41, - AvnPhysicalKeyKeyW = 42, - AvnPhysicalKeyKeyX = 43, - AvnPhysicalKeyKeyY = 44, - AvnPhysicalKeyKeyZ = 45, + AvnPhysicalKeyA = 20, + AvnPhysicalKeyB = 21, + AvnPhysicalKeyC = 22, + AvnPhysicalKeyD = 23, + AvnPhysicalKeyE = 24, + AvnPhysicalKeyF = 25, + AvnPhysicalKeyG = 26, + AvnPhysicalKeyH = 27, + AvnPhysicalKeyI = 28, + AvnPhysicalKeyJ = 29, + AvnPhysicalKeyK = 30, + AvnPhysicalKeyL = 31, + AvnPhysicalKeyM = 32, + AvnPhysicalKeyN = 33, + AvnPhysicalKeyO = 34, + AvnPhysicalKeyP = 35, + AvnPhysicalKeyQ = 36, + AvnPhysicalKeyR = 37, + AvnPhysicalKeyS = 38, + AvnPhysicalKeyT = 39, + AvnPhysicalKeyU = 40, + AvnPhysicalKeyV = 41, + AvnPhysicalKeyW = 42, + AvnPhysicalKeyX = 43, + AvnPhysicalKeyY = 44, + AvnPhysicalKeyZ = 45, AvnPhysicalKeyMinus = 46, AvnPhysicalKeyPeriod = 47, AvnPhysicalKeyQuote = 48, @@ -305,27 +305,27 @@ enum AvnPhysicalKey AvnPhysicalKeyArrowRight = 82, AvnPhysicalKeyArrowUp = 83, AvnPhysicalKeyNumLock = 84, - AvnPhysicalKeyNumpad0 = 85, - AvnPhysicalKeyNumpad1 = 86, - AvnPhysicalKeyNumpad2 = 87, - AvnPhysicalKeyNumpad3 = 88, - AvnPhysicalKeyNumpad4 = 89, - AvnPhysicalKeyNumpad5 = 90, - AvnPhysicalKeyNumpad6 = 91, - AvnPhysicalKeyNumpad7 = 92, - AvnPhysicalKeyNumpad8 = 93, - AvnPhysicalKeyNumpad9 = 94, - AvnPhysicalKeyNumpadAdd = 95, - AvnPhysicalKeyNumpadClear = 96, - AvnPhysicalKeyNumpadComma = 97, - AvnPhysicalKeyNumpadDecimal = 98, - AvnPhysicalKeyNumpadDivide = 99, - AvnPhysicalKeyNumpadEnter = 100, - AvnPhysicalKeyNumpadEqual = 101, - AvnPhysicalKeyNumpadMultiply = 102, - AvnPhysicalKeyNumpadParenLeft = 103, - AvnPhysicalKeyNumpadParenRight = 104, - AvnPhysicalKeyNumpadSubtract = 105, + AvnPhysicalKeyNumPad0 = 85, + AvnPhysicalKeyNumPad1 = 86, + AvnPhysicalKeyNumPad2 = 87, + AvnPhysicalKeyNumPad3 = 88, + AvnPhysicalKeyNumPad4 = 89, + AvnPhysicalKeyNumPad5 = 90, + AvnPhysicalKeyNumPad6 = 91, + AvnPhysicalKeyNumPad7 = 92, + AvnPhysicalKeyNumPad8 = 93, + AvnPhysicalKeyNumPad9 = 94, + AvnPhysicalKeyNumPadAdd = 95, + AvnPhysicalKeyNumPadClear = 96, + AvnPhysicalKeyNumPadComma = 97, + AvnPhysicalKeyNumPadDecimal = 98, + AvnPhysicalKeyNumPadDivide = 99, + AvnPhysicalKeyNumPadEnter = 100, + AvnPhysicalKeyNumPadEqual = 101, + AvnPhysicalKeyNumPadMultiply = 102, + AvnPhysicalKeyNumPadParenLeft = 103, + AvnPhysicalKeyNumPadParenRight = 104, + AvnPhysicalKeyNumPadSubtract = 105, AvnPhysicalKeyEscape = 106, AvnPhysicalKeyF1 = 107, AvnPhysicalKeyF2 = 108, diff --git a/src/Avalonia.X11/X11KeyTransform.cs b/src/Avalonia.X11/X11KeyTransform.cs index 40209ba7bab..3d360f53d7e 100644 --- a/src/Avalonia.X11/X11KeyTransform.cs +++ b/src/Avalonia.X11/X11KeyTransform.cs @@ -30,32 +30,32 @@ internal static class X11KeyTransform { 0x5E, PhysicalKey.IntlBackslash }, { 0x61, PhysicalKey.IntlRo }, { 0x84, PhysicalKey.IntlYen }, - { 0x26, PhysicalKey.KeyA }, - { 0x38, PhysicalKey.KeyB }, - { 0x36, PhysicalKey.KeyC }, - { 0x28, PhysicalKey.KeyD }, - { 0x1A, PhysicalKey.KeyE }, - { 0x29, PhysicalKey.KeyF }, - { 0x2A, PhysicalKey.KeyG }, - { 0x2B, PhysicalKey.KeyH }, - { 0x1F, PhysicalKey.KeyI }, - { 0x2C, PhysicalKey.KeyJ }, - { 0x2D, PhysicalKey.KeyK }, - { 0x2E, PhysicalKey.KeyL }, - { 0x3A, PhysicalKey.KeyM }, - { 0x39, PhysicalKey.KeyN }, - { 0x20, PhysicalKey.KeyO }, - { 0x21, PhysicalKey.KeyP }, - { 0x18, PhysicalKey.KeyQ }, - { 0x1B, PhysicalKey.KeyR }, - { 0x27, PhysicalKey.KeyS }, - { 0x1C, PhysicalKey.KeyT }, - { 0x1E, PhysicalKey.KeyU }, - { 0x37, PhysicalKey.KeyV }, - { 0x19, PhysicalKey.KeyW }, - { 0x35, PhysicalKey.KeyX }, - { 0x1D, PhysicalKey.KeyY }, - { 0x34, PhysicalKey.KeyZ }, + { 0x26, PhysicalKey.A }, + { 0x38, PhysicalKey.B }, + { 0x36, PhysicalKey.C }, + { 0x28, PhysicalKey.D }, + { 0x1A, PhysicalKey.E }, + { 0x29, PhysicalKey.F }, + { 0x2A, PhysicalKey.G }, + { 0x2B, PhysicalKey.H }, + { 0x1F, PhysicalKey.I }, + { 0x2C, PhysicalKey.J }, + { 0x2D, PhysicalKey.K }, + { 0x2E, PhysicalKey.L }, + { 0x3A, PhysicalKey.M }, + { 0x39, PhysicalKey.N }, + { 0x20, PhysicalKey.O }, + { 0x21, PhysicalKey.P }, + { 0x18, PhysicalKey.Q }, + { 0x1B, PhysicalKey.R }, + { 0x27, PhysicalKey.S }, + { 0x1C, PhysicalKey.T }, + { 0x1E, PhysicalKey.U }, + { 0x37, PhysicalKey.V }, + { 0x19, PhysicalKey.W }, + { 0x35, PhysicalKey.X }, + { 0x1D, PhysicalKey.Y }, + { 0x34, PhysicalKey.Z }, { 0x14, PhysicalKey.Minus }, { 0x3C, PhysicalKey.Period }, { 0x30, PhysicalKey.Quote }, @@ -103,27 +103,27 @@ internal static class X11KeyTransform // Numpad Section { 0x4D, PhysicalKey.NumLock }, - { 0x5A, PhysicalKey.Numpad0 }, - { 0x57, PhysicalKey.Numpad1 }, - { 0x58, PhysicalKey.Numpad2 }, - { 0x59, PhysicalKey.Numpad3 }, - { 0x53, PhysicalKey.Numpad4 }, - { 0x54, PhysicalKey.Numpad5 }, - { 0x55, PhysicalKey.Numpad6 }, - { 0x4F, PhysicalKey.Numpad7 }, - { 0x50, PhysicalKey.Numpad8 }, - { 0x51, PhysicalKey.Numpad9 }, - { 0x56, PhysicalKey.NumpadAdd }, - //{ , PhysicalKey.NumpadClear }, - { 0x81, PhysicalKey.NumpadComma }, - { 0x5B, PhysicalKey.NumpadDecimal }, - { 0x6A, PhysicalKey.NumpadDivide }, - { 0x68, PhysicalKey.NumpadEnter }, - { 0x7D, PhysicalKey.NumpadEqual }, - { 0x3F, PhysicalKey.NumpadMultiply }, - { 0xBB, PhysicalKey.NumpadParenLeft }, - { 0xBC, PhysicalKey.NumpadParenRight }, - { 0x52, PhysicalKey.NumpadSubtract }, + { 0x5A, PhysicalKey.NumPad0 }, + { 0x57, PhysicalKey.NumPad1 }, + { 0x58, PhysicalKey.NumPad2 }, + { 0x59, PhysicalKey.NumPad3 }, + { 0x53, PhysicalKey.NumPad4 }, + { 0x54, PhysicalKey.NumPad5 }, + { 0x55, PhysicalKey.NumPad6 }, + { 0x4F, PhysicalKey.NumPad7 }, + { 0x50, PhysicalKey.NumPad8 }, + { 0x51, PhysicalKey.NumPad9 }, + { 0x56, PhysicalKey.NumPadAdd }, + //{ , PhysicalKey.NumPadClear }, + { 0x81, PhysicalKey.NumPadComma }, + { 0x5B, PhysicalKey.NumPadDecimal }, + { 0x6A, PhysicalKey.NumPadDivide }, + { 0x68, PhysicalKey.NumPadEnter }, + { 0x7D, PhysicalKey.NumPadEqual }, + { 0x3F, PhysicalKey.NumPadMultiply }, + { 0xBB, PhysicalKey.NumPadParenLeft }, + { 0xBC, PhysicalKey.NumPadParenRight }, + { 0x52, PhysicalKey.NumPadSubtract }, // Function Section { 0x09, PhysicalKey.Escape }, diff --git a/src/Browser/Avalonia.Browser/KeyInterop.cs b/src/Browser/Avalonia.Browser/KeyInterop.cs index da53224e706..fc81cf8c2cd 100644 --- a/src/Browser/Avalonia.Browser/KeyInterop.cs +++ b/src/Browser/Avalonia.Browser/KeyInterop.cs @@ -32,32 +32,32 @@ internal static class KeyInterop { "IntlBackslash", PhysicalKey.IntlBackslash }, { "IntlRo", PhysicalKey.IntlRo }, { "IntlYen", PhysicalKey.IntlYen }, - { "KeyA", PhysicalKey.KeyA }, - { "KeyB", PhysicalKey.KeyB }, - { "KeyC", PhysicalKey.KeyC }, - { "KeyD", PhysicalKey.KeyD }, - { "KeyE", PhysicalKey.KeyE }, - { "KeyF", PhysicalKey.KeyF }, - { "KeyG", PhysicalKey.KeyG }, - { "KeyH", PhysicalKey.KeyH }, - { "KeyI", PhysicalKey.KeyI }, - { "KeyJ", PhysicalKey.KeyJ }, - { "KeyK", PhysicalKey.KeyK }, - { "KeyL", PhysicalKey.KeyL }, - { "KeyM", PhysicalKey.KeyM }, - { "KeyN", PhysicalKey.KeyN }, - { "KeyO", PhysicalKey.KeyO }, - { "KeyP", PhysicalKey.KeyP }, - { "KeyQ", PhysicalKey.KeyQ }, - { "KeyR", PhysicalKey.KeyR }, - { "KeyS", PhysicalKey.KeyS }, - { "KeyT", PhysicalKey.KeyT }, - { "KeyU", PhysicalKey.KeyU }, - { "KeyV", PhysicalKey.KeyV }, - { "KeyW", PhysicalKey.KeyW }, - { "KeyX", PhysicalKey.KeyX }, - { "KeyY", PhysicalKey.KeyY }, - { "KeyZ", PhysicalKey.KeyZ }, + { "KeyA", PhysicalKey.A }, + { "KeyB", PhysicalKey.B }, + { "KeyC", PhysicalKey.C }, + { "KeyD", PhysicalKey.D }, + { "KeyE", PhysicalKey.E }, + { "KeyF", PhysicalKey.F }, + { "KeyG", PhysicalKey.G }, + { "KeyH", PhysicalKey.H }, + { "KeyI", PhysicalKey.I }, + { "KeyJ", PhysicalKey.J }, + { "KeyK", PhysicalKey.K }, + { "KeyL", PhysicalKey.L }, + { "KeyM", PhysicalKey.M }, + { "KeyN", PhysicalKey.N }, + { "KeyO", PhysicalKey.O }, + { "KeyP", PhysicalKey.P }, + { "KeyQ", PhysicalKey.Q }, + { "KeyR", PhysicalKey.R }, + { "KeyS", PhysicalKey.S }, + { "KeyT", PhysicalKey.T }, + { "KeyU", PhysicalKey.U }, + { "KeyV", PhysicalKey.V }, + { "KeyW", PhysicalKey.W }, + { "KeyX", PhysicalKey.X }, + { "KeyY", PhysicalKey.Y }, + { "KeyZ", PhysicalKey.Z }, { "Minus", PhysicalKey.Minus }, { "Period", PhysicalKey.Period }, { "Quote", PhysicalKey.Quote }, @@ -107,27 +107,27 @@ internal static class KeyInterop // Numpad Section { "NumLock", PhysicalKey.NumLock }, - { "Numpad0", PhysicalKey.Numpad0 }, - { "Numpad1", PhysicalKey.Numpad1 }, - { "Numpad2", PhysicalKey.Numpad2 }, - { "Numpad3", PhysicalKey.Numpad3 }, - { "Numpad4", PhysicalKey.Numpad4 }, - { "Numpad5", PhysicalKey.Numpad5 }, - { "Numpad6", PhysicalKey.Numpad6 }, - { "Numpad7", PhysicalKey.Numpad7 }, - { "Numpad8", PhysicalKey.Numpad8 }, - { "Numpad9", PhysicalKey.Numpad9 }, - { "NumpadAdd", PhysicalKey.NumpadAdd }, - { "NumpadClear", PhysicalKey.NumpadClear }, - { "NumpadComma", PhysicalKey.NumpadComma }, - { "NumpadDecimal", PhysicalKey.NumpadDecimal }, - { "NumpadDivide", PhysicalKey.NumpadDivide }, - { "NumpadEnter", PhysicalKey.NumpadEnter }, - { "NumpadEqual", PhysicalKey.NumpadEqual }, - { "NumpadMultiply", PhysicalKey.NumpadMultiply }, - { "NumpadParenLeft", PhysicalKey.NumpadParenLeft }, - { "NumpadParenRight", PhysicalKey.NumpadParenRight }, - { "NumpadSubtract", PhysicalKey.NumpadSubtract }, + { "Numpad0", PhysicalKey.NumPad0 }, + { "Numpad1", PhysicalKey.NumPad1 }, + { "Numpad2", PhysicalKey.NumPad2 }, + { "Numpad3", PhysicalKey.NumPad3 }, + { "Numpad4", PhysicalKey.NumPad4 }, + { "Numpad5", PhysicalKey.NumPad5 }, + { "Numpad6", PhysicalKey.NumPad6 }, + { "Numpad7", PhysicalKey.NumPad7 }, + { "Numpad8", PhysicalKey.NumPad8 }, + { "Numpad9", PhysicalKey.NumPad9 }, + { "NumpadAdd", PhysicalKey.NumPadAdd }, + { "NumpadClear", PhysicalKey.NumPadClear }, + { "NumpadComma", PhysicalKey.NumPadComma }, + { "NumpadDecimal", PhysicalKey.NumPadDecimal }, + { "NumpadDivide", PhysicalKey.NumPadDivide }, + { "NumpadEnter", PhysicalKey.NumPadEnter }, + { "NumpadEqual", PhysicalKey.NumPadEqual }, + { "NumpadMultiply", PhysicalKey.NumPadMultiply }, + { "NumpadParenLeft", PhysicalKey.NumPadParenLeft }, + { "NumpadParenRight", PhysicalKey.NumPadParenRight }, + { "NumpadSubtract", PhysicalKey.NumPadSubtract }, // Function Section { "Escape", PhysicalKey.Escape }, @@ -396,20 +396,20 @@ public static Key KeyFromDomKey(string? domKey, PhysicalKey physicalKey) "Control" => physicalKey == PhysicalKey.ControlRight ? Key.RightCtrl : Key.LeftCtrl, "Shift" => physicalKey == PhysicalKey.ShiftRight ? Key.RightShift : Key.LeftShift, "Meta" => physicalKey == PhysicalKey.MetaRight ? Key.RWin : Key.LWin, - "0" => physicalKey == PhysicalKey.Numpad0 ? Key.NumPad0 : Key.D0, - "1" => physicalKey == PhysicalKey.Numpad1 ? Key.NumPad1 : Key.D1, - "2" => physicalKey == PhysicalKey.Numpad2 ? Key.NumPad2 : Key.D2, - "3" => physicalKey == PhysicalKey.Numpad3 ? Key.NumPad3 : Key.D3, - "4" => physicalKey == PhysicalKey.Numpad4 ? Key.NumPad4 : Key.D4, - "5" => physicalKey == PhysicalKey.Numpad5 ? Key.NumPad5 : Key.D5, - "6" => physicalKey == PhysicalKey.Numpad6 ? Key.NumPad6 : Key.D6, - "7" => physicalKey == PhysicalKey.Numpad7 ? Key.NumPad7 : Key.D7, - "8" => physicalKey == PhysicalKey.Numpad8 ? Key.NumPad8 : Key.D8, - "9" => physicalKey == PhysicalKey.Numpad9 ? Key.NumPad9 : Key.D9, - "+" => physicalKey == PhysicalKey.NumpadAdd ? Key.Add : Key.OemPlus, - "-" => physicalKey == PhysicalKey.NumpadSubtract ? Key.Subtract : Key.OemMinus, - "*" => physicalKey == PhysicalKey.NumpadMultiply ? Key.Multiply : Key.None, - "/" => physicalKey == PhysicalKey.NumpadDivide ? Key.Divide : Key.None, + "0" => physicalKey == PhysicalKey.NumPad0 ? Key.NumPad0 : Key.D0, + "1" => physicalKey == PhysicalKey.NumPad1 ? Key.NumPad1 : Key.D1, + "2" => physicalKey == PhysicalKey.NumPad2 ? Key.NumPad2 : Key.D2, + "3" => physicalKey == PhysicalKey.NumPad3 ? Key.NumPad3 : Key.D3, + "4" => physicalKey == PhysicalKey.NumPad4 ? Key.NumPad4 : Key.D4, + "5" => physicalKey == PhysicalKey.NumPad5 ? Key.NumPad5 : Key.D5, + "6" => physicalKey == PhysicalKey.NumPad6 ? Key.NumPad6 : Key.D6, + "7" => physicalKey == PhysicalKey.NumPad7 ? Key.NumPad7 : Key.D7, + "8" => physicalKey == PhysicalKey.NumPad8 ? Key.NumPad8 : Key.D8, + "9" => physicalKey == PhysicalKey.NumPad9 ? Key.NumPad9 : Key.D9, + "+" => physicalKey == PhysicalKey.NumPadAdd ? Key.Add : Key.OemPlus, + "-" => physicalKey == PhysicalKey.NumPadSubtract ? Key.Subtract : Key.OemMinus, + "*" => physicalKey == PhysicalKey.NumPadMultiply ? Key.Multiply : Key.None, + "/" => physicalKey == PhysicalKey.NumPadDivide ? Key.Divide : Key.None, _ => Key.None }; diff --git a/src/Windows/Avalonia.Win32/Input/KeyInterop.cs b/src/Windows/Avalonia.Win32/Input/KeyInterop.cs index 78ef66b8dba..834feb861ee 100644 --- a/src/Windows/Avalonia.Win32/Input/KeyInterop.cs +++ b/src/Windows/Avalonia.Win32/Input/KeyInterop.cs @@ -213,32 +213,32 @@ public static class KeyInterop { 0x0056, PhysicalKey.IntlBackslash }, { 0x0073, PhysicalKey.IntlRo }, { 0x007D, PhysicalKey.IntlYen }, - { 0x001E, PhysicalKey.KeyA }, - { 0x0030, PhysicalKey.KeyB }, - { 0x002E, PhysicalKey.KeyC }, - { 0x0020, PhysicalKey.KeyD }, - { 0x0012, PhysicalKey.KeyE }, - { 0x0021, PhysicalKey.KeyF }, - { 0x0022, PhysicalKey.KeyG }, - { 0x0023, PhysicalKey.KeyH }, - { 0x0017, PhysicalKey.KeyI }, - { 0x0024, PhysicalKey.KeyJ }, - { 0x0025, PhysicalKey.KeyK }, - { 0x0026, PhysicalKey.KeyL }, - { 0x0032, PhysicalKey.KeyM }, - { 0x0031, PhysicalKey.KeyN }, - { 0x0018, PhysicalKey.KeyO }, - { 0x0019, PhysicalKey.KeyP }, - { 0x0010, PhysicalKey.KeyQ }, - { 0x0013, PhysicalKey.KeyR }, - { 0x001F, PhysicalKey.KeyS }, - { 0x0014, PhysicalKey.KeyT }, - { 0x0016, PhysicalKey.KeyU }, - { 0x002F, PhysicalKey.KeyV }, - { 0x0011, PhysicalKey.KeyW }, - { 0x002D, PhysicalKey.KeyX }, - { 0x0015, PhysicalKey.KeyY }, - { 0x002C, PhysicalKey.KeyZ }, + { 0x001E, PhysicalKey.A }, + { 0x0030, PhysicalKey.B }, + { 0x002E, PhysicalKey.C }, + { 0x0020, PhysicalKey.D }, + { 0x0012, PhysicalKey.E }, + { 0x0021, PhysicalKey.F }, + { 0x0022, PhysicalKey.G }, + { 0x0023, PhysicalKey.H }, + { 0x0017, PhysicalKey.I }, + { 0x0024, PhysicalKey.J }, + { 0x0025, PhysicalKey.K }, + { 0x0026, PhysicalKey.L }, + { 0x0032, PhysicalKey.M }, + { 0x0031, PhysicalKey.N }, + { 0x0018, PhysicalKey.O }, + { 0x0019, PhysicalKey.P }, + { 0x0010, PhysicalKey.Q }, + { 0x0013, PhysicalKey.R }, + { 0x001F, PhysicalKey.S }, + { 0x0014, PhysicalKey.T }, + { 0x0016, PhysicalKey.U }, + { 0x002F, PhysicalKey.V }, + { 0x0011, PhysicalKey.W }, + { 0x002D, PhysicalKey.X }, + { 0x0015, PhysicalKey.Y }, + { 0x002C, PhysicalKey.Z }, { 0x000C, PhysicalKey.Minus }, { 0x0034, PhysicalKey.Period }, { 0x0028, PhysicalKey.Quote }, @@ -286,27 +286,27 @@ public static class KeyInterop // Numpad Section { 0xE045, PhysicalKey.NumLock }, - { 0x0052, PhysicalKey.Numpad0 }, - { 0x004F, PhysicalKey.Numpad1 }, - { 0x0050, PhysicalKey.Numpad2 }, - { 0x0051, PhysicalKey.Numpad3 }, - { 0x004B, PhysicalKey.Numpad4 }, - { 0x004C, PhysicalKey.Numpad5 }, - { 0x004D, PhysicalKey.Numpad6 }, - { 0x0047, PhysicalKey.Numpad7 }, - { 0x0048, PhysicalKey.Numpad8 }, - { 0x0049, PhysicalKey.Numpad9 }, - { 0x004E, PhysicalKey.NumpadAdd }, - //{ , PhysicalKey.NumpadClear }, - { 0x007E, PhysicalKey.NumpadComma }, - { 0x0053, PhysicalKey.NumpadDecimal }, - { 0xE035, PhysicalKey.NumpadDivide }, - { 0xE01C, PhysicalKey.NumpadEnter }, - { 0x0059, PhysicalKey.NumpadEqual }, - { 0x0037, PhysicalKey.NumpadMultiply }, - //{ , PhysicalKey.NumpadParenLeft }, - //{ , PhysicalKey.NumpadParenRight }, - { 0x004A, PhysicalKey.NumpadSubtract }, + { 0x0052, PhysicalKey.NumPad0 }, + { 0x004F, PhysicalKey.NumPad1 }, + { 0x0050, PhysicalKey.NumPad2 }, + { 0x0051, PhysicalKey.NumPad3 }, + { 0x004B, PhysicalKey.NumPad4 }, + { 0x004C, PhysicalKey.NumPad5 }, + { 0x004D, PhysicalKey.NumPad6 }, + { 0x0047, PhysicalKey.NumPad7 }, + { 0x0048, PhysicalKey.NumPad8 }, + { 0x0049, PhysicalKey.NumPad9 }, + { 0x004E, PhysicalKey.NumPadAdd }, + //{ , PhysicalKey.NumPadClear }, + { 0x007E, PhysicalKey.NumPadComma }, + { 0x0053, PhysicalKey.NumPadDecimal }, + { 0xE035, PhysicalKey.NumPadDivide }, + { 0xE01C, PhysicalKey.NumPadEnter }, + { 0x0059, PhysicalKey.NumPadEqual }, + { 0x0037, PhysicalKey.NumPadMultiply }, + //{ , PhysicalKey.NumPadParenLeft }, + //{ , PhysicalKey.NumPadParenRight }, + { 0x004A, PhysicalKey.NumPadSubtract }, // Function Section { 0x0001, PhysicalKey.Escape }, diff --git a/tests/Avalonia.Base.UnitTests/Input/KeyboardDeviceTests.cs b/tests/Avalonia.Base.UnitTests/Input/KeyboardDeviceTests.cs index f2b1d07fe54..28cb9c92828 100644 --- a/tests/Avalonia.Base.UnitTests/Input/KeyboardDeviceTests.cs +++ b/tests/Avalonia.Base.UnitTests/Input/KeyboardDeviceTests.cs @@ -25,7 +25,7 @@ public void Keypresses_Should_Be_Sent_To_Root_If_No_Focused_Element() RawKeyEventType.KeyDown, Key.A, RawInputModifiers.None, - PhysicalKey.KeyA, + PhysicalKey.A, "a")); root.Verify(x => x.RaiseEvent(It.IsAny())); @@ -54,7 +54,7 @@ public void Keypresses_Should_Be_Sent_To_Focused_Element() RawKeyEventType.KeyDown, Key.A, RawInputModifiers.None, - PhysicalKey.KeyA, + PhysicalKey.A, "a")); Assert.Equal(1, raised); @@ -128,7 +128,7 @@ public void Can_Change_KeyBindings_In_Keybinding_Event_Handler() RawKeyEventType.KeyDown, Key.O, RawInputModifiers.Control, - PhysicalKey.KeyO, + PhysicalKey.O, "o")); Assert.Equal(1, raised); diff --git a/tests/Avalonia.Controls.UnitTests/HotKeyedControlsTests.cs b/tests/Avalonia.Controls.UnitTests/HotKeyedControlsTests.cs index b66985094b1..c15fc7b9168 100644 --- a/tests/Avalonia.Controls.UnitTests/HotKeyedControlsTests.cs +++ b/tests/Avalonia.Controls.UnitTests/HotKeyedControlsTests.cs @@ -115,7 +115,7 @@ public void HotKeyedTextBox_Focus_Performed_On_Hotkey() RawKeyEventType.KeyDown, Key.F, RawInputModifiers.Control, - PhysicalKey.KeyF, + PhysicalKey.F, "f")); Assert.True(hotKeyedTextBox.IsFocused); diff --git a/tests/Avalonia.Controls.UnitTests/TopLevelTests.cs b/tests/Avalonia.Controls.UnitTests/TopLevelTests.cs index d2267119a33..8da5265ecc5 100644 --- a/tests/Avalonia.Controls.UnitTests/TopLevelTests.cs +++ b/tests/Avalonia.Controls.UnitTests/TopLevelTests.cs @@ -212,7 +212,7 @@ public void Impl_Input_Should_Pass_Input_To_InputManager() RawKeyEventType.KeyDown, Key.A, RawInputModifiers.None, - PhysicalKey.KeyA, + PhysicalKey.A, "a"); impl.Object.Input(input); diff --git a/tests/Avalonia.Controls.UnitTests/Utils/HotKeyManagerTests.cs b/tests/Avalonia.Controls.UnitTests/Utils/HotKeyManagerTests.cs index 67fe15c139c..6d47f2504bc 100644 --- a/tests/Avalonia.Controls.UnitTests/Utils/HotKeyManagerTests.cs +++ b/tests/Avalonia.Controls.UnitTests/Utils/HotKeyManagerTests.cs @@ -89,7 +89,7 @@ public void HotKeyManager_Should_Use_CommandParameter(string factoryName, Factor RawKeyEventType.KeyDown, Key.A, RawInputModifiers.Control, - PhysicalKey.KeyA, + PhysicalKey.A, "a")); Assert.True(expectedParameter == commandResult, $"{factoryName} HotKey did not carry the CommandParameter."); @@ -132,7 +132,7 @@ public void HotKeyManager_Should_Do_Not_Executed_When_IsEnabled_False(string fac RawKeyEventType.KeyDown, Key.A, RawInputModifiers.Control, - PhysicalKey.KeyA, + PhysicalKey.A, "a")); Assert.True(isExecuted == false, $"{factoryName} Execution raised when IsEnabled is false."); @@ -176,7 +176,7 @@ void Clickable_Click(object sender, Interactivity.RoutedEventArgs e) RawKeyEventType.KeyDown, Key.A, RawInputModifiers.Control, - PhysicalKey.KeyA, + PhysicalKey.A, "a")); element.IsEnabled = false; @@ -187,7 +187,7 @@ void Clickable_Click(object sender, Interactivity.RoutedEventArgs e) RawKeyEventType.KeyDown, Key.A, RawInputModifiers.Control, - PhysicalKey.KeyA, + PhysicalKey.A, "a")); @@ -238,7 +238,7 @@ void Clickable_Click(object sender, Interactivity.RoutedEventArgs e) RawKeyEventType.KeyDown, Key.A, RawInputModifiers.Control, - PhysicalKey.KeyA, + PhysicalKey.A, "a")); element.IsEnabled = false; @@ -249,7 +249,7 @@ void Clickable_Click(object sender, Interactivity.RoutedEventArgs e) RawKeyEventType.KeyDown, Key.A, RawInputModifiers.Control, - PhysicalKey.KeyA, + PhysicalKey.A, "a")); Assert.True(commandExecutedCount == 1, $"{factoryName} Execution raised when IsEnabled is false.");