diff --git a/RGB.NET.Devices.Wooting/Enum/WootingLogicalKeyboardLayout.cs b/RGB.NET.Devices.Wooting/Enum/WootingLogicalKeyboardLayout.cs index 59976fb..640bfee 100644 --- a/RGB.NET.Devices.Wooting/Enum/WootingLogicalKeyboardLayout.cs +++ b/RGB.NET.Devices.Wooting/Enum/WootingLogicalKeyboardLayout.cs @@ -8,9 +8,14 @@ namespace RGB.NET.Devices.Wooting.Enum /// /// Contains list of available logical layouts for cooler master keyboards. /// + /// + /// Based on what is available in the shop: https://wooting.store/collections/wooting-keyboards/products/wooting-two + /// public enum WootingLogicalKeyboardLayout { US = 0, - UK = 1 + UK = 1, + DE = 2, + ND = 3 }; } diff --git a/RGB.NET.Devices.Wooting/Enum/WootingPhysicalKeyboardLayout.cs b/RGB.NET.Devices.Wooting/Enum/WootingPhysicalKeyboardLayout.cs index 2b37cbf..07d830f 100644 --- a/RGB.NET.Devices.Wooting/Enum/WootingPhysicalKeyboardLayout.cs +++ b/RGB.NET.Devices.Wooting/Enum/WootingPhysicalKeyboardLayout.cs @@ -8,6 +8,9 @@ namespace RGB.NET.Devices.Wooting.Enum /// /// Contains list of available physical layouts for Wooting keyboards. /// + /// + /// Shop states ANSI (US) and ISO (UK/German/Nodics) - https://wooting.store/collections/wooting-keyboards/products/wooting-two + /// public enum WootingPhysicalKeyboardLayout { US = 0, diff --git a/RGB.NET.Devices.Wooting/Keyboard/WootingKeyboardLedMappings.cs b/RGB.NET.Devices.Wooting/Keyboard/WootingKeyboardLedMappings.cs index 8993654..2f032f6 100644 --- a/RGB.NET.Devices.Wooting/Keyboard/WootingKeyboardLedMappings.cs +++ b/RGB.NET.Devices.Wooting/Keyboard/WootingKeyboardLedMappings.cs @@ -32,7 +32,7 @@ namespace RGB.NET.Devices.Wooting.Keyboard { LedId.Keyboard_F12, (0,13) }, { LedId.Keyboard_PrintScreen, (0,14) }, { LedId.Keyboard_PauseBreak, (0,15) }, - { LedId.Keyboard_Custom1, (0,20) }, // TODO: Make sure it is not 0,16 + { LedId.Keyboard_Custom1, (0,20) }, { LedId.Keyboard_GraveAccentAndTilde, (1,0) }, { LedId.Keyboard_1, (1,1) }, @@ -85,7 +85,6 @@ namespace RGB.NET.Devices.Wooting.Keyboard { LedId.Keyboard_Enter, (3,13) }, { LedId.Keyboard_LeftShift, (4,0) }, - { LedId.Keyboard_NonUsBackslash, (4,1) }, { LedId.Keyboard_Z, (4,2) }, { LedId.Keyboard_X, (4,3) }, { LedId.Keyboard_C, (4,4) }, @@ -112,6 +111,104 @@ namespace RGB.NET.Devices.Wooting.Keyboard { LedId.Keyboard_ArrowRight, (5,16) } }; + private static readonly Dictionary WootingOne_UK = new Dictionary + { + { LedId.Keyboard_Escape, (0,0) }, + { LedId.Keyboard_F1, (0,2) }, + { LedId.Keyboard_F2, (0,3) }, + { LedId.Keyboard_F3, (0,4) }, + { LedId.Keyboard_F4, (0,5) }, + { LedId.Keyboard_F5, (0,6) }, + { LedId.Keyboard_F6, (0,7) }, + { LedId.Keyboard_F7, (0,8) }, + { LedId.Keyboard_F8, (0,9) }, + { LedId.Keyboard_F9, (0,10) }, + { LedId.Keyboard_F10, (0,11) }, + { LedId.Keyboard_F11, (0,12) }, + { LedId.Keyboard_F12, (0,13) }, + { LedId.Keyboard_PrintScreen, (0,14) }, + { LedId.Keyboard_PauseBreak, (0,15) }, + { LedId.Keyboard_Custom1, (0,20) }, + + { LedId.Keyboard_GraveAccentAndTilde, (1,0) }, + { LedId.Keyboard_1, (1,1) }, + { LedId.Keyboard_2, (1,2) }, + { LedId.Keyboard_3, (1,3) }, + { LedId.Keyboard_4, (1,4) }, + { LedId.Keyboard_5, (1,5) }, + { LedId.Keyboard_6, (1,6) }, + { LedId.Keyboard_7, (1,7) }, + { LedId.Keyboard_8, (1,8) }, + { LedId.Keyboard_9, (1,9) }, + { LedId.Keyboard_0, (1,10) }, + { LedId.Keyboard_MinusAndUnderscore, (1,11) }, + { LedId.Keyboard_EqualsAndPlus, (1,12) }, + { LedId.Keyboard_Backspace, (1,13) }, + { LedId.Keyboard_Insert, (1,14) }, + { LedId.Keyboard_Home, (1,15) }, + { LedId.Keyboard_PageUp, (1,16) }, + + { LedId.Keyboard_Tab, (2,0) }, + { LedId.Keyboard_Q, (2,1) }, + { LedId.Keyboard_W, (2,2) }, + { LedId.Keyboard_E, (2,3) }, + { LedId.Keyboard_R, (2,4) }, + { LedId.Keyboard_T, (2,5) }, + { LedId.Keyboard_Y, (2,6) }, + { LedId.Keyboard_U, (2,7) }, + { LedId.Keyboard_I, (2,8) }, + { LedId.Keyboard_O, (2,9) }, + { LedId.Keyboard_P, (2,10) }, + { LedId.Keyboard_BracketLeft, (2,11) }, + { LedId.Keyboard_BracketRight, (2,12) }, + { LedId.Keyboard_Backslash, (2,13) }, + { LedId.Keyboard_Delete, (2,14) }, + { LedId.Keyboard_End, (2,15) }, + { LedId.Keyboard_PageDown, (2,16) }, + + { LedId.Keyboard_CapsLock, (3,0) }, + { LedId.Keyboard_A, (3,1) }, + { LedId.Keyboard_S, (3,2) }, + { LedId.Keyboard_D, (3,3) }, + { LedId.Keyboard_F, (3,4) }, + { LedId.Keyboard_G, (3,5) }, + { LedId.Keyboard_H, (3,6) }, + { LedId.Keyboard_J, (3,7) }, + { LedId.Keyboard_K, (3,8) }, + { LedId.Keyboard_L, (3,9) }, + { LedId.Keyboard_SemicolonAndColon, (3,10) }, + { LedId.Keyboard_ApostropheAndDoubleQuote, (3,11) }, + { LedId.Keyboard_NonUsTilde, (3,11) }, + { LedId.Keyboard_Enter, (3,13) }, + + { LedId.Keyboard_LeftShift, (4,0) }, + { LedId.Keyboard_NonUsBackslash, (4,1) }, + { LedId.Keyboard_Z, (4,2) }, + { LedId.Keyboard_X, (4,3) }, + { LedId.Keyboard_C, (4,4) }, + { LedId.Keyboard_V, (4,5) }, + { LedId.Keyboard_B, (4,6) }, + { LedId.Keyboard_N, (4,7) }, + { LedId.Keyboard_M, (4,8) }, + { LedId.Keyboard_CommaAndLessThan, (4,9) }, + { LedId.Keyboard_PeriodAndBiggerThan, (4,10) }, + { LedId.Keyboard_SlashAndQuestionMark, (4,11) }, + { LedId.Keyboard_RightShift, (4,13) }, + { LedId.Keyboard_ArrowUp, (4,15) }, + + { LedId.Keyboard_LeftCtrl, (5,0) }, + { LedId.Keyboard_LeftGui, (5,1) }, + { LedId.Keyboard_LeftAlt, (5,2) }, + { LedId.Keyboard_Space, (5,6) }, + { LedId.Keyboard_RightAlt, (5,10) }, + { LedId.Keyboard_RightGui, (5,11) }, + { LedId.Keyboard_Application, (5,12) }, + { LedId.Keyboard_RightCtrl, (5,13) }, + { LedId.Keyboard_ArrowLeft, (5,14) }, + { LedId.Keyboard_ArrowDown, (5,15) }, + { LedId.Keyboard_ArrowRight, (5,16) } + }; + #endregion #region Wooting Two @@ -200,6 +297,124 @@ namespace RGB.NET.Devices.Wooting.Keyboard { LedId.Keyboard_Num5, (3,18) }, { LedId.Keyboard_Num6, (3,19) }, + { LedId.Keyboard_LeftShift, (4,0) }, + { LedId.Keyboard_Z, (4,2) }, + { LedId.Keyboard_X, (4,3) }, + { LedId.Keyboard_C, (4,4) }, + { LedId.Keyboard_V, (4,5) }, + { LedId.Keyboard_B, (4,6) }, + { LedId.Keyboard_N, (4,7) }, + { LedId.Keyboard_M, (4,8) }, + { LedId.Keyboard_CommaAndLessThan, (4,9) }, + { LedId.Keyboard_PeriodAndBiggerThan, (4,10) }, + { LedId.Keyboard_SlashAndQuestionMark, (4,11) }, + { LedId.Keyboard_RightShift, (4,13) }, + { LedId.Keyboard_ArrowUp, (4,15) }, + { LedId.Keyboard_Num1, (4,17) }, + { LedId.Keyboard_Num2, (4,18) }, + { LedId.Keyboard_Num3, (4,19) }, + { LedId.Keyboard_NumEnter, (4,20) }, + + { LedId.Keyboard_LeftCtrl, (5,0) }, + { LedId.Keyboard_LeftGui, (5,1) }, + { LedId.Keyboard_LeftAlt, (5,2) }, + { LedId.Keyboard_Space, (5,6) }, + { LedId.Keyboard_RightAlt, (5,10) }, + { LedId.Keyboard_RightGui, (5,11) }, + { LedId.Keyboard_Application, (5,12) }, + { LedId.Keyboard_RightCtrl, (5,13) }, + { LedId.Keyboard_ArrowLeft, (5,14) }, + { LedId.Keyboard_ArrowDown, (5,15) }, + { LedId.Keyboard_ArrowRight, (5,16) }, + { LedId.Keyboard_Num0, (5,18) }, + { LedId.Keyboard_NumPeriodAndDelete, (5,19) } + }; + + private static readonly Dictionary WootingTwo_UK = new Dictionary + { + { LedId.Keyboard_Escape, (0,0) }, + { LedId.Keyboard_F1, (0,2) }, + { LedId.Keyboard_F2, (0,3) }, + { LedId.Keyboard_F3, (0,4) }, + { LedId.Keyboard_F4, (0,5) }, + { LedId.Keyboard_F5, (0,6) }, + { LedId.Keyboard_F6, (0,7) }, + { LedId.Keyboard_F7, (0,8) }, + { LedId.Keyboard_F8, (0,9) }, + { LedId.Keyboard_F9, (0,10) }, + { LedId.Keyboard_F10, (0,11) }, + { LedId.Keyboard_F11, (0,12) }, + { LedId.Keyboard_F12, (0,13) }, + { LedId.Keyboard_PrintScreen, (0,14) }, + { LedId.Keyboard_PauseBreak, (0,15) }, + { LedId.Keyboard_ScrollLock, (0,16) }, + { LedId.Keyboard_Custom1, (0,17) }, + { LedId.Keyboard_Custom2, (0,18) }, + { LedId.Keyboard_Custom3, (0,19) }, + { LedId.Keyboard_Custom4, (0,20) }, + + { LedId.Keyboard_GraveAccentAndTilde, (1,0) }, + { LedId.Keyboard_1, (1,1) }, + { LedId.Keyboard_2, (1,2) }, + { LedId.Keyboard_3, (1,3) }, + { LedId.Keyboard_4, (1,4) }, + { LedId.Keyboard_5, (1,5) }, + { LedId.Keyboard_6, (1,6) }, + { LedId.Keyboard_7, (1,7) }, + { LedId.Keyboard_8, (1,8) }, + { LedId.Keyboard_9, (1,9) }, + { LedId.Keyboard_0, (1,10) }, + { LedId.Keyboard_MinusAndUnderscore, (1,11) }, + { LedId.Keyboard_EqualsAndPlus, (1,12) }, + { LedId.Keyboard_Backspace, (1,13) }, + { LedId.Keyboard_Insert, (1,14) }, + { LedId.Keyboard_Home, (1,15) }, + { LedId.Keyboard_PageUp, (1,16) }, + { LedId.Keyboard_NumLock, (1,17) }, + { LedId.Keyboard_NumSlash, (1,18) }, + { LedId.Keyboard_NumAsterisk, (1,19) }, + { LedId.Keyboard_NumMinus, (1,20) }, + + { LedId.Keyboard_Tab, (2,0) }, + { LedId.Keyboard_Q, (2,1) }, + { LedId.Keyboard_W, (2,2) }, + { LedId.Keyboard_E, (2,3) }, + { LedId.Keyboard_R, (2,4) }, + { LedId.Keyboard_T, (2,5) }, + { LedId.Keyboard_Y, (2,6) }, + { LedId.Keyboard_U, (2,7) }, + { LedId.Keyboard_I, (2,8) }, + { LedId.Keyboard_O, (2,9) }, + { LedId.Keyboard_P, (2,10) }, + { LedId.Keyboard_BracketLeft, (2,11) }, + { LedId.Keyboard_BracketRight, (2,12) }, + { LedId.Keyboard_Backslash, (2,13) }, + { LedId.Keyboard_Delete, (2,14) }, + { LedId.Keyboard_End, (2,15) }, + { LedId.Keyboard_PageDown, (2,16) }, + { LedId.Keyboard_Num7, (2,17) }, + { LedId.Keyboard_Num8, (2,18) }, + { LedId.Keyboard_Num9, (2,19) }, + { LedId.Keyboard_NumPlus, (2,20) }, + + { LedId.Keyboard_CapsLock, (3,0) }, + { LedId.Keyboard_A, (3,1) }, + { LedId.Keyboard_S, (3,2) }, + { LedId.Keyboard_D, (3,3) }, + { LedId.Keyboard_F, (3,4) }, + { LedId.Keyboard_G, (3,5) }, + { LedId.Keyboard_H, (3,6) }, + { LedId.Keyboard_J, (3,7) }, + { LedId.Keyboard_K, (3,8) }, + { LedId.Keyboard_L, (3,9) }, + { LedId.Keyboard_SemicolonAndColon, (3,10) }, + { LedId.Keyboard_ApostropheAndDoubleQuote, (3,11) }, + { LedId.Keyboard_NonUsTilde, (3,12) }, + { LedId.Keyboard_Enter, (3,13) }, + { LedId.Keyboard_Num4, (3,17) }, + { LedId.Keyboard_Num5, (3,18) }, + { LedId.Keyboard_Num6, (3,19) }, + { LedId.Keyboard_LeftShift, (4,0) }, { LedId.Keyboard_NonUsBackslash, (4,1) }, { LedId.Keyboard_Z, (4,2) }, @@ -245,14 +460,14 @@ namespace RGB.NET.Devices.Wooting.Keyboard { WootingDevicesIndexes.WootingOne, new Dictionary> { { WootingPhysicalKeyboardLayout.US, WootingOne_US }, - { WootingPhysicalKeyboardLayout.UK, WootingOne_US } + { WootingPhysicalKeyboardLayout.UK, WootingOne_UK } } }, { WootingDevicesIndexes.WootingTwo, new Dictionary> { { WootingPhysicalKeyboardLayout.US, WootingTwo_US }, - { WootingPhysicalKeyboardLayout.UK, WootingTwo_US } + { WootingPhysicalKeyboardLayout.UK, WootingTwo_UK } } } }; diff --git a/RGB.NET.Devices.Wooting/Keyboard/WootingKeyboardRGBDeviceInfo.cs b/RGB.NET.Devices.Wooting/Keyboard/WootingKeyboardRGBDeviceInfo.cs index 3df72f8..b2bcc70 100644 --- a/RGB.NET.Devices.Wooting/Keyboard/WootingKeyboardRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Wooting/Keyboard/WootingKeyboardRGBDeviceInfo.cs @@ -1,5 +1,4 @@ -using System; -using System.Globalization; +using System.Globalization; using RGB.NET.Core; using RGB.NET.Devices.Wooting.Enum; using RGB.NET.Devices.Wooting.Generic; @@ -35,22 +34,30 @@ namespace RGB.NET.Devices.Wooting.Keyboard /// The index of the . /// The of the . /// The of the layout this keyboard is using - internal WootingKeyboardRGBDeviceInfo(WootingDevicesIndexes deviceIndex, WootingPhysicalKeyboardLayout physicalKeyboardLayout, CultureInfo culture) - : base(RGBDeviceType.Keyboard, deviceIndex) + internal WootingKeyboardRGBDeviceInfo(WootingDevicesIndexes deviceIndex, WootingPhysicalKeyboardLayout physicalKeyboardLayout, + CultureInfo culture) + : base(RGBDeviceType.Keyboard, deviceIndex) { this.PhysicalLayout = physicalKeyboardLayout; - switch (physicalKeyboardLayout) + DetermineLogicalLayout(culture.KeyboardLayoutId); + } + + private void DetermineLogicalLayout(int keyboardLayoutId) + { + switch (keyboardLayoutId) { - case WootingPhysicalKeyboardLayout.US: - this.LogicalLayout = WootingLogicalKeyboardLayout.US; - break; - case WootingPhysicalKeyboardLayout.UK: - this.LogicalLayout = WootingLogicalKeyboardLayout.UK; + // TODO SpoinkyNL 15-12-2019: There doesn't seem to be an accurate way to determine this, perhaps it should be a configurable thing.. + // I'm using US International and it's reporting nl-NL's 1043. Also you can after all just swap your keycaps + default: + if (PhysicalLayout == WootingPhysicalKeyboardLayout.US) + LogicalLayout = WootingLogicalKeyboardLayout.US; + else + LogicalLayout = WootingLogicalKeyboardLayout.UK; break; } } - + #endregion } }