Skip to content

Commit cce1d99

Browse files
committed
Mark Key.IMESelected obsolete
1 parent 3e11b97 commit cce1d99

File tree

6 files changed

+17
-9
lines changed

6 files changed

+17
-9
lines changed

Assets/Tests/InputSystem/APIVerificationTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,8 @@ public class DualShock4GamepadHID : DualShockGamepad
556556
")]
557557
// KeyboardState state size has increased to support more keys like F13-F24
558558
[ScopedExclusionProperty("1.0.0", "UnityEngine.InputSystem.LowLevel", "public struct KeyboardState : IInputStateTypeInfo", "public fixed byte keys[14];")]
559+
// Allow Key.IMESelected to be marked as Obsolete
560+
[ScopedExclusionProperty("1.0.0", "UnityEngine.InputSystem", "public enum Key", "IMESelected = 111,")]
559561
public void API_MinorVersionsHaveNoBreakingChanges()
560562
{
561563
var currentVersion = CoreTests.PackageJson.ReadVersion();

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)Key.IMESelected) // Skip IMESelected as it's not a real key.
129+
if (++keyIndex == (int)KeyEx.IMESelected) // Skip IMESelected as it's not a real key.
130130
continue;
131131
key.ReadValue();
132132
}

Assets/Tests/InputSystem/CoreTests_Devices.cs

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

26842684
[Test]
26852685
[Category("Devices")]
2686+
[Obsolete("Test obsolete IMESelected Key")]
26862687
public void Devices_ImeSelectedKeyOnKeyboard_SupportObsoleteIMESelectedKey()
26872688
{
26882689
var keyboard = InputSystem.AddDevice<Keyboard>();

Packages/com.unity.inputsystem/CHANGELOG.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ however, it has to be formatted properly to pass verification tests.
1010

1111
## [Unreleased] - yyyy-mm-dd
1212

13+
### Changed
14+
- Changed enum value `Key.IMESelected` to obsolete which was not a real key. Please use the ButtonControl `imeSelected`.
15+
16+
### Added
17+
- Added support of F13-F24 keys. [UUM-44328](https://issuetracker.unity3d.com/product/unity/issues/guid/UUM-44328)
18+
1319
## [1.13.1] - 2025-02-18
1420

1521
### Fixed
@@ -22,9 +28,6 @@ however, it has to be formatted properly to pass verification tests.
2228
### Changed
2329
- Changed default input action asset name from New Controls to New Actions.
2430

25-
### Added
26-
- Added support of F13-F24 keys. [UUM-44328](https://issuetracker.unity3d.com/product/unity/issues/guid/UUM-44328)
27-
2831
## [1.13.0] - 2025-02-05
2932

3033
### Fixed

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ public KeyboardState(bool IMESelected, params Key[] pressedKeys)
207207

208208
if (IMESelected)
209209
{
210-
MemoryHelpers.WriteSingleBit(keysPtr, (uint)Key.IMESelected, true);
210+
MemoryHelpers.WriteSingleBit(keysPtr, (uint)KeyEx.IMESelected, true);
211211
}
212212

213213
for (var i = 0; i < pressedKeys.Length; ++i)
@@ -906,6 +906,7 @@ public enum Key
906906
/// Don't use this. This is a dummy key that is only used internally to represent the IME selected state.
907907
/// Will be removed in the future.
908908
/// </summary>
909+
[Obsolete("IMESelected is a dummy key and will be removed in the future. Please use ButtonControl imeSelected")]
909910
IMESelected,
910911

911912
/// <summary>
@@ -979,7 +980,8 @@ public enum Key
979980

980981
internal static class KeyEx
981982
{
982-
internal const Key RemappedIMESelected = (Key)127; //IMESelected value
983+
internal const Key IMESelected = (Key)111; // Key.IMESelected value
984+
internal const Key RemappedIMESelected = (Key)127; // Remapped to the end of buffer of Key InternalForIMESelected
983985
}
984986

985987
/// <summary>
@@ -2679,9 +2681,9 @@ unsafe bool IEventPreProcessor.PreProcessEvent(InputEventPtr currentEventPtr)
26792681
if (stateEvent->stateFormat == KeyboardState.Format)
26802682
{
26812683
var keyboardState = ((KeyboardState*)(stateEvent->stateData));
2682-
if (keyboardState->Get(Key.IMESelected))
2684+
if (keyboardState->Get(KeyEx.IMESelected))
26832685
{
2684-
keyboardState->Set(Key.IMESelected, false);
2686+
keyboardState->Set(KeyEx.IMESelected, false);
26852687
keyboardState->Set(KeyEx.RemappedIMESelected, true);
26862688
}
26872689
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +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:
148+
case KeyEx.IMESelected:
149149
return false;
150150
}
151151
return true;

0 commit comments

Comments
 (0)