Skip to content

Commit 2772d6d

Browse files
authored
Merge branch 'develop' into docs-quality-week-2024-touch
2 parents feb0b34 + fcb4731 commit 2772d6d

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

Packages/com.unity.inputsystem/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ however, it has to be formatted properly to pass verification tests.
7171
- Fixed potential crash on Mac when using stale references to deleted InputDevice objects [ISXB-606](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-606).
7272
- Fixed conditional compilation for non-editor analytics on platforms not enabling analytics.
7373
- Fixed simulated touch input not working with PlayerInput component [ISXB-483](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-483).
74+
- Fixed unused PenState information to determine the displayIndex on platforms providing it. (PLAT-10123)
7475

7576
### Changed
7677
- Renamed editor Resources directories to PackageResources to fix package validation warnings.

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,10 @@ public struct PenState : IInputStateTypeInfo
9898
[FieldOffset(32)]
9999
public ushort buttons;
100100

101-
// Not currently used, but still needed in this struct for padding,
102-
// as il2cpp does not implement FieldOffset.
101+
/// <summary>
102+
/// The index of the display that was touched.
103+
/// </summary>
104+
[InputControl(name = "displayIndex", displayName = "Display Index", layout = "Integer")]
103105
[FieldOffset(34)]
104106
ushort displayIndex;
105107

@@ -379,6 +381,7 @@ protected override void FinishSetup()
379381
inRange = GetChildControl<ButtonControl>("inRange");
380382
tilt = GetChildControl<Vector2Control>("tilt");
381383
twist = GetChildControl<AxisControl>("twist");
384+
displayIndex = GetChildControl<IntegerControl>("displayIndex");
382385
base.FinishSetup();
383386
}
384387
}

Packages/com.unity.inputsystem/InputSystem/Plugins/InputForUI/InputSystemProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ void OnPointerPerformed(InputAction.CallbackContext ctx)
420420
m_SeenPenEvents = true;
421421

422422
var positionISX = ctx.ReadValue<Vector2>();
423-
var targetDisplay = asPointerDevice != null ? asPointerDevice.displayIndex.ReadValue() : (asTouchscreenDevice != null ? asTouchscreenDevice.displayIndex.ReadValue() : 0);
423+
var targetDisplay = asPointerDevice != null ? asPointerDevice.displayIndex.ReadValue() : (asTouchscreenDevice != null ? asTouchscreenDevice.displayIndex.ReadValue() : (asPenDevice != null ? asPenDevice.displayIndex.ReadValue() : 0));
424424
var position = ScreenBottomLeftToPanelPosition(positionISX, targetDisplay);
425425
var delta = pointerState.LastPositionValid ? position - pointerState.LastPosition : Vector2.zero;
426426

0 commit comments

Comments
 (0)