Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Assets/Tests/InputSystem/Plugins/UITests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3829,7 +3829,7 @@ public IEnumerator UI_WhenCursorIsLockedToScreenCenter_PointerEnterAndExitEvents
}

#region Multi Display Tests
#if UNITY_2023_1_OR_NEWER // displayIndex is only available from 2023.1 onwards
#if UNITY_2022_3_OR_NEWER // displayIndex is only available from 2022.3 onwards

[UnityTest]
#if UNITY_TVOS
Expand Down Expand Up @@ -4377,7 +4377,7 @@ private static ExtendedPointerEventData ClonePointerEventData(PointerEventData e
radius = eventData.radius,
radiusVariance = eventData.radiusVariance,
#endif
#if UNITY_2023_1_OR_NEWER
#if UNITY_2022_3_OR_NEWER
displayIndex = eventData.displayIndex,
#endif
};
Expand Down
3 changes: 3 additions & 0 deletions Packages/com.unity.inputsystem/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ however, it has to be formatted properly to pass verification tests.

## [Unreleased]

### Added
- Enabled `displayIndex` support for Unity 2022.3.

### Fixed
- Fixed UI clicks not registering when OS provides multiple input sources for the same event, e.g. on Samsung Dex (case ISX-1416, ISXB-342).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public override string ToString()
stringBuilder.AppendLine("altitudeAngle: " + altitudeAngle);
stringBuilder.AppendLine("twist: " + twist);
#endif
#if UNITY_2023_1_OR_NEWER
#if UNITY_2022_3_OR_NEWER
stringBuilder.AppendLine("displayIndex: " + displayIndex);
#endif
return stringBuilder.ToString();
Expand Down Expand Up @@ -142,7 +142,7 @@ internal void ReadDeviceState()
altitudeAngle = (pen.tilt.value.y + 1) * Mathf.PI / 2;
twist = pen.twist.value * Mathf.PI * 2;
#endif
#if UNITY_2023_1_OR_NEWER
#if UNITY_2022_3_OR_NEWER
displayIndex = pen.displayIndex.ReadValue();
#endif
}
Expand All @@ -153,7 +153,7 @@ internal void ReadDeviceState()
pressure = touchControl.pressure.magnitude;
radius = touchControl.radius.value;
#endif
#if UNITY_2023_1_OR_NEWER
#if UNITY_2022_3_OR_NEWER
displayIndex = touchControl.displayIndex.ReadValue();
#endif
}
Expand All @@ -164,7 +164,7 @@ internal void ReadDeviceState()
pressure = touchscreen.pressure.magnitude;
radius = touchscreen.radius.value;
#endif
#if UNITY_2023_1_OR_NEWER
#if UNITY_2022_3_OR_NEWER
displayIndex = touchscreen.displayIndex.ReadValue();
#endif
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1737,7 +1737,7 @@ private int GetPointerStateIndexFor(InputControl control, bool createIfNotExists
eventData.pointerType = pointerType;
eventData.pointerId = pointerId;
eventData.touchId = touchId;
#if UNITY_2023_1_OR_NEWER
#if UNITY_2022_3_OR_NEWER
eventData.displayIndex = displayIndex;
#endif

Expand Down Expand Up @@ -1833,7 +1833,7 @@ private int AllocatePointer(int pointerId, int displayIndex, int touchId, UIPoin
eventData = new ExtendedPointerEventData(eventSystem);

eventData.pointerId = pointerId;
#if UNITY_2023_1_OR_NEWER
#if UNITY_2022_3_OR_NEWER
eventData.displayIndex = displayIndex;
#endif
eventData.touchId = touchId;
Expand Down Expand Up @@ -1959,7 +1959,7 @@ private void OnPointCallback(InputAction.CallbackContext context)

ref var state = ref GetPointerStateForIndex(index);
state.screenPosition = context.ReadValue<Vector2>();
#if UNITY_2023_1_OR_NEWER
#if UNITY_2022_3_OR_NEWER
state.eventData.displayIndex = GetDisplayIndexFor(context.control);
#endif
}
Expand Down Expand Up @@ -1990,7 +1990,7 @@ private void OnLeftClickCallback(InputAction.CallbackContext context)
state.changedThisFrame = true;
if (IgnoreNextClick(ref context, wasPressed))
state.leftButton.ignoreNextClick = true;
#if UNITY_2023_1_OR_NEWER
#if UNITY_2022_3_OR_NEWER
state.eventData.displayIndex = GetDisplayIndexFor(context.control);
#endif
}
Expand All @@ -2007,7 +2007,7 @@ private void OnRightClickCallback(InputAction.CallbackContext context)
state.changedThisFrame = true;
if (IgnoreNextClick(ref context, wasPressed))
state.rightButton.ignoreNextClick = true;
#if UNITY_2023_1_OR_NEWER
#if UNITY_2022_3_OR_NEWER
state.eventData.displayIndex = GetDisplayIndexFor(context.control);
#endif
}
Expand All @@ -2024,7 +2024,7 @@ private void OnMiddleClickCallback(InputAction.CallbackContext context)
state.changedThisFrame = true;
if (IgnoreNextClick(ref context, wasPressed))
state.middleButton.ignoreNextClick = true;
#if UNITY_2023_1_OR_NEWER
#if UNITY_2022_3_OR_NEWER
state.eventData.displayIndex = GetDisplayIndexFor(context.control);
#endif
}
Expand Down Expand Up @@ -2055,7 +2055,7 @@ private void OnScrollCallback(InputAction.CallbackContext context)
// The old input system reported scroll deltas in lines, we report pixels.
// Need to scale as the UI system expects lines.
state.scrollDelta = context.ReadValue<Vector2>() * (1 / kPixelPerLine);
#if UNITY_2023_1_OR_NEWER
#if UNITY_2022_3_OR_NEWER
state.eventData.displayIndex = GetDisplayIndexFor(context.control);
#endif
}
Expand All @@ -2074,7 +2074,7 @@ private void OnTrackedDeviceOrientationCallback(InputAction.CallbackContext cont

ref var state = ref GetPointerStateForIndex(index);
state.worldOrientation = context.ReadValue<Quaternion>();
#if UNITY_2023_1_OR_NEWER
#if UNITY_2022_3_OR_NEWER
state.eventData.displayIndex = GetDisplayIndexFor(context.control);
#endif
}
Expand All @@ -2087,7 +2087,7 @@ private void OnTrackedDevicePositionCallback(InputAction.CallbackContext context

ref var state = ref GetPointerStateForIndex(index);
state.worldPosition = context.ReadValue<Vector3>();
#if UNITY_2023_1_OR_NEWER
#if UNITY_2022_3_OR_NEWER
state.eventData.displayIndex = GetDisplayIndexFor(context.control);
#endif
}
Expand Down