Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android input handlers refactor #5317

Merged
merged 25 commits into from
Aug 5, 2022
Merged

Conversation

Susko3
Copy link
Member

@Susko3 Susko3 commented Jul 19, 2022

Changes include:

  • Incrementing FrameStatistics when enqueuing input
  • Full NRT coverage
  • Logging of unhandled events
    • Should help when adding new input types (eg. proper stylus handling) and to provide more context to input-related bug reports.
  • Added some missing keyboard keys
  • Historic handling of non-relative mouse input
  • Historic handling of touch input
  • Proper TouchSource validation for touch input
  • General cleanup

Historic handling of touch input

Explainer: https://developer.android.com/reference/android/view/MotionEvent#batching

This is especially important if the game/device is lagging. Previously we were dropping a lot of events. I expect the UI to feel marginally smoother with historic handling, and scrolling/dragging to be more precise.

Before After (with batching, historic handling)
before after

Copy link
Member

@peppy peppy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine otherwise.

@@ -30,6 +31,8 @@ public abstract class AndroidInputHandler : InputHandler
/// </summary>
protected readonly AndroidGameView View;

public override string Description => base.Description.Replace("Android", null);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reads a bit weird. Is this to make things display correctly in settings?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Settings use custom LocalizabeStrings instead of this.

This is used when logging unhandled events and takes inspiration from InputHandler.Description:

Logger.Log($"Unknown {Description} {methodName} event: {inputEvent}");

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just leave the Android in the description? If it's not displayed anywhere else, I think I'd prefer it being there in logs.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, the Description can stay as-is, but logs will use GetType().ReadableName()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still a bit confused here. Can we revert the Replace part?

Adds complexity and is not really used anywhere,
as some of the handlers override it.
@peppy peppy merged commit 859cbd4 into ppy:master Aug 5, 2022
@Susko3 Susko3 deleted the android-input-refactor branch August 5, 2022 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants