Skip to content

Commit 99705d9

Browse files
committed
removed all obsolete and breaking changes
1 parent b081c2c commit 99705d9

File tree

5 files changed

+10
-13
lines changed

5 files changed

+10
-13
lines changed

Assets/QA/Tests/KeyboardMouseBasic/Scripts/ButtonStateHex.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,20 @@ string GetStringForKBButtonState(Keyboard keyboard)
4444
int workingInt = 0;
4545
int offset = 0;
4646
string retVal = "";
47-
int nbKeys = (int)Key.F24;
4847

49-
for (int j = nbKeys / 16; j >= 0; j--)
48+
for (int j = ((int)(Keyboard.KeyCount)) / 16; j >= 0; j--)
5049
{
5150
workingInt = 0;
5251
offset = j * 16;
5352
for (int i = 15; i >= 0; i--)
5453
{
55-
if (i + offset != 0 && i + offset < nbKeys)
54+
if (i + offset != 0 && i + offset < ((int)(Keyboard.KeyCount)))
5655
{
5756
workingInt |= _BoolHelper(keyboard[(Key)(offset + i)].ReadValue() != 0f) << (i);
5857
}
5958
}
6059

61-
if (j != nbKeys / 16) { retVal += "."; } // Don't put a trailing period because it looks dumb
60+
if (j != ((int)(Keyboard.KeyCount)) / 16) { retVal += "."; } // Don't put a trailing period because it looks dumb
6261
retVal += workingInt.ToString("X4");
6362
}
6463

Assets/Tests/InputSystem/CorePerformanceTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public void Performance_ReadEveryKey()
126126
int keyIndex = 0;
127127
foreach (var key in keyboard.allKeys)
128128
{
129-
if (++keyIndex == (int)KeyEx.IMESelected) // Skip IMESelected as it's not a real key.
129+
if (++keyIndex == (int)Key.IMESelected) // Skip IMESelected as it's not a real key.
130130
continue;
131131
key.ReadValue();
132132
}

Assets/Tests/InputSystem/CoreTests_Devices.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2683,7 +2683,6 @@ public void Devices_AnyKeyOnKeyboard_DoesNotReactToIMESelected()
26832683

26842684
[Test]
26852685
[Category("Devices")]
2686-
[Obsolete("Test obsolete IMESelected Key")]
26872686
public void Devices_ImeSelectedKeyOnKeyboard_SupportObsoleteIMESelectedKey()
26882687
{
26892688
var keyboard = InputSystem.AddDevice<Keyboard>();

Packages/com.unity.inputsystem/InputSystem/Devices/Keyboard.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ public unsafe struct KeyboardState : IInputStateTypeInfo
4646
/// <seealso cref="InputStateBlock.format"/>
4747
public static FourCC Format => new FourCC('K', 'E', 'Y', 'S');
4848

49-
private const int kSizeInBits = Keyboard.ExtendedKeyCount; // +1 for IMESelected.
49+
private const int kSizeInBits = Keyboard.ExtendedKeyCount;
5050
internal const int kSizeInBytes = (kSizeInBits + 7) / 8;
5151

52-
[InputControl(name = "anyKey", displayName = "Any Key", layout = "AnyKey", bit = 1, sizeInBits = (int)Key.F24, synthetic = true)]
52+
[InputControl(name = "anyKey", displayName = "Any Key", layout = "AnyKey", bit = 1, sizeInBits = kSizeInBits, synthetic = true)]
5353
[InputControl(name = "escape", displayName = "Escape", layout = "Key", usages = new[] {"Back", "Cancel"}, bit = (int)Key.Escape)]
5454
[InputControl(name = "space", displayName = "Space", layout = "Key", bit = (int)Key.Space)]
5555
[InputControl(name = "enter", displayName = "Enter", layout = "Key", usage = "Submit", bit = (int)Key.Enter)]
@@ -195,7 +195,7 @@ public KeyboardState(bool IMESelected, params Key[] pressedKeys)
195195

196196
if (IMESelected)
197197
{
198-
MemoryHelpers.WriteSingleBit(keysPtr, (uint)KeyEx.IMESelected, true);
198+
MemoryHelpers.WriteSingleBit(keysPtr, (uint)Key.IMESelected, true);
199199
}
200200

201201
for (var i = 0; i < pressedKeys.Length; ++i)
@@ -894,7 +894,6 @@ public enum Key
894894
/// Don't use this. This is a dummy key that is only used internally to represent the IME selected state.
895895
/// Will be removed in the future.
896896
/// </summary>
897-
//[Obsolete("Don't use this. This is a dummy key that is only used internally to represent the IME selected state. Will be removed in the future.", false)]
898897
IMESelected,
899898

900899
/// <summary>
@@ -968,7 +967,6 @@ public enum Key
968967

969968
internal static class KeyEx
970969
{
971-
internal const Key IMESelected = (Key)111; //IMESelected value
972970
internal const Key RemappedIMESelected = (Key)127; //IMESelected value
973971
}
974972

@@ -2661,9 +2659,9 @@ public unsafe bool PreProcessEvent(InputEventPtr currentEventPtr)
26612659
if (stateEvent->stateFormat == KeyboardState.Format)
26622660
{
26632661
var keyboardState = ((KeyboardState*)(stateEvent->stateData));
2664-
if (keyboardState->Get(KeyEx.IMESelected))
2662+
if (keyboardState->Get(Key.IMESelected))
26652663
{
2666-
keyboardState->Set(KeyEx.IMESelected, false);
2664+
keyboardState->Set(Key.IMESelected, false);
26672665
keyboardState->Set(KeyEx.RemappedIMESelected, true);
26682666
}
26692667
}

Packages/com.unity.inputsystem/InputSystem/InputExtensions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ public static bool IsTextInputKey(this Key key)
145145
case Key.OEM3:
146146
case Key.OEM4:
147147
case Key.OEM5:
148+
case Key.IMESelected:
148149
return false;
149150
}
150151
return true;

0 commit comments

Comments
 (0)