stride icon indicating copy to clipboard operation
stride copied to clipboard

[Input] Add System Pointer Id

Open joreg opened this issue 3 years ago • 3 comments

PR Details

Introduces a SystemPointerId property which is different from the already existing PointerId in that it passes through the original, unmodified pointer Id provided by the OS.

Description

Adds a SystemPointerId to PointerEvent and a SystemId to PointerPoint allowing the different framework implementations to pass through the original, unmodified Ids as provided by the OS.

Questions

  • For now, I only implemented this for SDL. How would I do this for the other backends which I cannot test?
  • Looking at the implementations of how the existing PointerId is generated in the different backends iOS, Android, SDL and UWP, it is obvious that iOS and SDL work the same. Android might be the same, hard to understand without testing (the Android docs are not really vocal about the nature of the Id). And UWP, doesn't seem to modify the Id, ie may already currently be working differently than the others.. So how to deal with that?

Related Issue

Motivation and Context

Under Windows, this solves the issue that we can now use an API like InteractionContext, which relies on those original Ids.

Types of changes

  • [ ] Docs change / refactoring / dependency upgrade
  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • [ ] My change requires a change to the documentation.
  • [ ] I have added tests to cover my changes.
  • [ ] All new and existing tests passed.

joreg avatar Jun 11 '21 10:06 joreg

For now, I only implemented this for SDL. How would I do this for the other backends which I cannot test?

Good question. Maybe we can have a default fallback behavior, as long as it's explained in the member documentation (default to 0 or random or PointerId or something like that)

xen2 avatar Jun 16 '21 04:06 xen2

it now defaults to 0 on all implementations but SDL. so you mean just adding to the remarks of SystemPointerId: "NOTE: If this returns 0, then it is not implemented yet!"?

and how about the UWP case where I suspect the PointerId currently working like SystemPointerId. there, changing the behavior of PointerId to conform to the other implementations would be a breaking change. but one could argue it is a bugfix?!

joreg avatar Jun 16 '21 16:06 joreg

I'm not very familiar with this so bare with me. For InteractionContext to work in your case you need a 'unique' value for each new PointerEvent ? Should those value match those reported by sdl exactly or can you emulate the behavior sdl uses to generate them and use those ? If the latter is true, you could emulate that behavior for all other platforms and rename that variable to something that would reflect that behavior, that way we don't have any platform differences where there is no need to.

Eideren avatar Aug 05 '21 00:08 Eideren