microsoft / WindowsAppSDK

The Windows App SDK empowers all Windows desktop apps with modern Windows UI, APIs, and platform features, including back-compat support, shipped via NuGet.
https://docs.microsoft.com/windows/apps/windows-app-sdk/
MIT License
3.81k stars 320 forks source link

GestureRecognizer.ProcessMoveEvents throws COMException with multi-touch screen #3992

Open jeremy-visionaid opened 10 months ago

jeremy-visionaid commented 10 months ago

Describe the bug

Attempting to use the GestureRecognizer throws a COMException with a blank error message.

Swallowing the exception results in the tap not being recognized/raised.

Steps to reproduce the bug

  1. Write a WinAppSDK sample app similar to the UWP documentation at https://learn.microsoft.com/en-us/uwp/api/windows.ui.input.gesturerecognizer?view=winrt-22621
  2. Tap two fingers on the screen simulataneously
  3. COMException is thrown from ProcessMoveEvents

Expected behavior

Tap gesture recognized/raised

Screenshots

No response

NuGet package version

Windows App SDK 1.4.3: 1.4.231115000

Packaging type

Unpackaged

Windows version

Windows 11 version 22H2 (22621, 2022 Update)

IDE

Visual Studio 2022

Additional context

The same behavior occurs with the UWP sample app:

https://github.com/microsoft/windows-universal-samples/tree/main/Samples/BasicInput

However, there the exception message is

Input data cannot be processed in the non-chronological order.

Input data cannot be processed in the non-chronological order.

Note the duplication is actually part of the message, not a typo

jeremy-visionaid commented 10 months ago

The problem seems to be that the gesture recognizer should just be ignoring the duplicate PointerMoved events for the additional contact points. Probably silently ignoring them would seem more appropriate that throwing an exception. Or perhaps the documentation and/or example should be updated to reflect the expectation that the user do the filtering if that's intended. but given the API, it really seems like that should be the GestureRecognizer's responsibility.

20:19:25:366    OnPointerMoved ID: 132
20:19:25:614    Timestamp: 1085131994
20:19:25:614    Timestamp: 1085128036
20:19:25:614    Timestamp: 1085121996
20:19:25:614    Timestamp: 1085115007
20:19:25:614    Timestamp: 1085108992
20:19:25:614    Timestamp: 1085103002
20:19:25:614    Timestamp: 1085097001
20:19:25:614    Timestamp: 1085091005
20:19:25:870    Timestamp: 1085084997
20:19:25:870    Timestamp: 1085077999
20:19:25:870    Timestamp: 1085071995
20:19:25:870    OnPointerMoved ID: 133
20:19:25:870    Timestamp: 1085131994
20:19:25:870    Timestamp: 1085128036
20:19:25:870    Timestamp: 1085121996
20:19:25:870    Timestamp: 1085115007
20:19:26:118    Timestamp: 1085108992
20:19:26:118    Timestamp: 1085103002
20:19:26:118    Timestamp: 1085097001
20:19:26:118    Timestamp: 1085091005
20:19:26:118    Timestamp: 1085084997
20:19:26:118    Timestamp: 1085077999
20:19:26:118    Timestamp: 1085071995