Skip to content

Commit cdda2bd

Browse files
committed
Updated changes with recent GetNavigationEventDeviceType method.
1 parent ffd26de commit cdda2bd

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

Assets/Tests/InputSystem/Plugins/UITests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2916,7 +2916,8 @@ public IEnumerator UI_CanDriveUIFromGamepad()
29162916
OneEvent("moveVector", gamepad.leftStick.ReadValue())));
29172917
Assert.That(scene.rightChildReceiver.events, Is.Empty);
29182918

2919-
Assert.That(scene.uiModule.IsNonKeyboardNavigationEvent(scene.leftChildReceiver.events[0].data));
2919+
Assert.That(scene.uiModule.GetNavigationEventDeviceType(scene.leftChildReceiver.events[0].data),
2920+
Is.EqualTo(NavigationDeviceType.NonKeyboard));
29202921

29212922
scene.leftChildReceiver.events.Clear();
29222923

Packages/com.unity.inputsystem/InputSystem/Plugins/UI/InputSystemUIInputModule.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2457,10 +2457,14 @@ public override Vector2 ConvertPointerEventScrollDeltaToTicks(Vector2 scrollDelt
24572457

24582458
#endif
24592459

2460-
#if UNITY_INPUT_SYSTEM_INPUT_MODULE_NON_KEYBOARD
2461-
public override bool IsNonKeyboardNavigationEvent(BaseEventData eventData)
2462-
{
2463-
return eventData is INavigationEventData eed && eed.device is not Keyboard;
2460+
#if UNITY_INPUT_SYSTEM_INPUT_MODULE_NAVIGATION_DEVICE_TYPE
2461+
public override NavigationDeviceType GetNavigationEventDeviceType(BaseEventData eventData)
2462+
{
2463+
if (eventData is not INavigationEventData eed)
2464+
return NavigationDeviceType.Unknown;
2465+
if (eed.device is Keyboard)
2466+
return NavigationDeviceType.Keyboard;
2467+
return NavigationDeviceType.NonKeyboard;
24642468
}
24652469
#endif
24662470

Packages/com.unity.inputsystem/InputSystem/Unity.InputSystem.asmdef

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
{
9696
"name": "Unity",
9797
"expression": "6000.1.0b2",
98-
"define": "UNITY_INPUT_SYSTEM_INPUT_MODULE_NON_KEYBOARD"
98+
"define": "UNITY_INPUT_SYSTEM_INPUT_MODULE_NAVIGATION_DEVICE_TYPE"
9999
},
100100
{
101101
"name": "Unity",

0 commit comments

Comments
 (0)