Skip to content

Commit

Permalink
Updated changes with recent GetNavigationEventDeviceType method.
Browse files Browse the repository at this point in the history
  • Loading branch information
benoitalain committed Jan 10, 2025
1 parent ffd26de commit cdda2bd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
3 changes: 2 additions & 1 deletion Assets/Tests/InputSystem/Plugins/UITests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2916,7 +2916,8 @@ public IEnumerator UI_CanDriveUIFromGamepad()
OneEvent("moveVector", gamepad.leftStick.ReadValue())));
Assert.That(scene.rightChildReceiver.events, Is.Empty);

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

scene.leftChildReceiver.events.Clear();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2457,10 +2457,14 @@ public override Vector2 ConvertPointerEventScrollDeltaToTicks(Vector2 scrollDelt

#endif

#if UNITY_INPUT_SYSTEM_INPUT_MODULE_NON_KEYBOARD
public override bool IsNonKeyboardNavigationEvent(BaseEventData eventData)
{
return eventData is INavigationEventData eed && eed.device is not Keyboard;
#if UNITY_INPUT_SYSTEM_INPUT_MODULE_NAVIGATION_DEVICE_TYPE
public override NavigationDeviceType GetNavigationEventDeviceType(BaseEventData eventData)
{
if (eventData is not INavigationEventData eed)
return NavigationDeviceType.Unknown;
if (eed.device is Keyboard)
return NavigationDeviceType.Keyboard;
return NavigationDeviceType.NonKeyboard;
}
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
{
"name": "Unity",
"expression": "6000.1.0b2",
"define": "UNITY_INPUT_SYSTEM_INPUT_MODULE_NON_KEYBOARD"
"define": "UNITY_INPUT_SYSTEM_INPUT_MODULE_NAVIGATION_DEVICE_TYPE"
},
{
"name": "Unity",
Expand Down

0 comments on commit cdda2bd

Please sign in to comment.