From ed71c81ed6532782b6fe6bad8155682142a93730 Mon Sep 17 00:00:00 2001 From: Martin Zikmund Date: Wed, 15 Jan 2025 18:10:36 +0100 Subject: [PATCH] fix: Improve reliability of new sequence --- .../Input/Preview.Injection/InjectedInputState.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/Uno.UWP/UI/Input/Preview.Injection/InjectedInputState.cs b/src/Uno.UWP/UI/Input/Preview.Injection/InjectedInputState.cs index 9e6463958fef..908213c778a1 100644 --- a/src/Uno.UWP/UI/Input/Preview.Injection/InjectedInputState.cs +++ b/src/Uno.UWP/UI/Input/Preview.Injection/InjectedInputState.cs @@ -16,7 +16,7 @@ internal class InjectedInputState public InjectedInputState(PointerDeviceType type) { Type = type; - StartNewSequence(); + StartNewSequence(true); } public PointerDeviceType Type { get; } @@ -31,9 +31,17 @@ public InjectedInputState(PointerDeviceType type) public PointerPointProperties Properties { get; set; } = new(); - public void StartNewSequence() + public void StartNewSequence(bool initial = false) { - Timestamp = (ulong)Stopwatch.GetElapsedTime(_initialTimestamp).TotalMicroseconds; + if (initial) + { + Timestamp = (ulong)Stopwatch.GetElapsedTime(_initialTimestamp).TotalMicroseconds; + } + else + { + Timestamp = Timestamp + 1000; // Continue from the previous timestamp, but move forward in time by 1ms + } + FrameId = (uint)(Timestamp / 1000); }