Skip to content

Commit ab7f306

Browse files
author
Dmytro Ivanov
committed
API validator fixes
1 parent 219e951 commit ab7f306

File tree

4 files changed

+23
-7
lines changed

4 files changed

+23
-7
lines changed

Assets/Tests/InputSystem/APIVerificationTests.cs

+8
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,14 @@ public class SwitchProControllerHID : UnityEngine.InputSystem.Gamepad
424424
[Property("Exclusions", @"1.0.0
425425
public class DualShock4GamepadHID : UnityEngine.InputSystem.DualShock.DualShockGamepad
426426
")]
427+
// IMECompositionEvent added unsafe attribute
428+
[Property("Exclusions", @"1.0.0
429+
public struct IMECompositionEvent : UnityEngine.InputSystem.LowLevel.IInputEventTypeInfo
430+
")]
431+
// IMECompositionEvent.compositionString changed from field to property due to hard-to-avoid changes to IMECompositionString struct
432+
[Property("Exclusions", @"1.0.0
433+
public UnityEngine.InputSystem.LowLevel.IMECompositionString compositionString;
434+
")]
427435
public void API_MinorVersionsHaveNoBreakingChanges()
428436
{
429437
var currentVersion = CoreTests.PackageJson.ReadVersion();

Packages/com.unity.inputsystem/Documentation~/Events.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ There are three types of Device events:
7070
There are two types of text events:
7171

7272
* [`TextEvent`](../api/UnityEngine.InputSystem.LowLevel.TextEvent.html) (`'TEXT'`)
73-
* [`IMECompositionEvent`](../api/UnityEngine.InputSystem.LowLevel.IMECompositionEvent.html) (`'IMES'`)
73+
* [`IMECompositionEventVariableSize`](../api/UnityEngine.InputSystem.LowLevel.IMECompositionEventVariableSize.html) (`'IMEC'`)
7474

7575
## Working with events
7676

Packages/com.unity.inputsystem/Documentation~/filter.yml

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
apiRules:
2+
- include:
3+
# IMECompositionEvent is marked as obsolete
4+
uid: UnityEngine.InputSystem.LowLevel.IMECompositionEvent
5+
type: Type
26
- exclude:
37
# inherited Object methods
48
uidRegex: ^System\.Object\..*$

Packages/com.unity.inputsystem/InputSystem/Events/IMECompositionEvent.cs

+10-6
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,19 @@
66
using Unity.Collections.LowLevel.Unsafe;
77
using UnityEngine.InputSystem.Utilities;
88

9+
//// TODO for v2 remove and replace with just string.
10+
911
namespace UnityEngine.InputSystem.LowLevel
1012
{
11-
[Obsolete("IMECompositionEvent is obsolete, please use IMECompositionEventVariableSize")]
13+
/// <summary>
14+
/// Deprecated variant of IME composition event. Please use <see cref="IMECompositionEventVariableSize"/> for replacement.
15+
/// </summary>
16+
[Obsolete("Use IMECompositionEventVariableSize instead.")]
1217
[StructLayout(LayoutKind.Explicit, Size = InputEvent.kBaseEventSize + sizeof(int) + (sizeof(char) * kIMECharBufferSize))]
1318
public unsafe struct IMECompositionEvent : IInputEventTypeInfo
1419
{
1520
// These needs to match the native ImeCompositionStringInputEventData settings
16-
internal const int kIMECharBufferSize = 64;
21+
private const int kIMECharBufferSize = 64;
1722
public const int Type = 0x494D4553;
1823

1924
[FieldOffset(0)]
@@ -76,7 +81,7 @@ public struct IMECompositionEventVariableSize : IInputEventTypeInfo
7681
/// Returns composition string for the given event.
7782
/// </summary>
7883
/// <param name="ev">Pointer to the event.</param>
79-
/// <returns></returns>
84+
/// <returns>Composition string.</returns>
8085
public static unsafe IMECompositionString GetIMECompositionString(IMECompositionEventVariableSize* ev)
8186
{
8287
return new IMECompositionString(GetCharsPtr(ev), ev->length);
@@ -85,9 +90,9 @@ public static unsafe IMECompositionString GetIMECompositionString(IMEComposition
8590
/// <summary>
8691
/// Queues up an IME Composition Event. IME Event sizes are variable, and this simplifies the process of aligning up the Input Event information and actual IME composition string.
8792
/// </summary>
88-
/// <param name="deviceId">ID of the device (see <see cref="InputDevice.deviceId") to which the composition event should be sent to. Should be an <see cref="ITextInputReceiver"/> device. Will trigger <see cref="ITextInputReceiver.OnIMECompositionChanged"/> call when processed.</param>
93+
/// <param name="deviceId">ID of the device (see <see cref="InputDevice.deviceId"/>) to which the composition event should be sent to. Should be an <see cref="ITextInputReceiver"/> device. Will trigger <see cref="ITextInputReceiver.OnIMECompositionChanged"/> call when processed.</param>
8994
/// <param name="str">The IME characters to be sent. This can be any length, or left blank to represent a resetting of the IME dialog.</param>
90-
/// <param name="time">The time in seconds, the event was generated at. This uses the same timeline as <see cref="Time.realtimeSinceStartup"/></param>
95+
/// <param name="time">The time in seconds, the event was generated at. This uses the same timeline as <see cref="Time.realtimeSinceStartup"/></param>
9196
public static unsafe void QueueEvent(int deviceId, string str, double time)
9297
{
9398
var sizeInBytes = (InputEvent.kBaseEventSize + sizeof(int)) + sizeof(char) * str.Length;
@@ -108,7 +113,6 @@ public static unsafe void QueueEvent(int deviceId, string str, double time)
108113
}
109114
}
110115

111-
//// TODO for v2 remove and replace with just string.
112116
/// <summary>
113117
/// A struct representing an string of characters generated by an IME for text input.
114118
/// </summary>

0 commit comments

Comments
 (0)