From 4273d7785286684f4e90a4d04c8e7934138c78dc Mon Sep 17 00:00:00 2001 From: lindexi Date: Thu, 11 Sep 2025 15:53:05 +0800 Subject: [PATCH] Fix StylusPlugIn OnStylusDown/Move/Up invoked on UI thread and called out of order --- .../System/Windows/Input/Stylus/Wisp/PenContexts.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Wisp/PenContexts.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Wisp/PenContexts.cs index 17446dcfe..43e1a5db8 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Wisp/PenContexts.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Wisp/PenContexts.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. @@ -512,7 +512,7 @@ internal StylusPlugInCollection TargetPlugInCollection(RawStylusInputReport inpu ptTablet = ptTablet * stylusDevice.TabletDevice.TabletDeviceImpl.TabletToScreen; ptTablet.X = (int)Math.Round(ptTablet.X); // Make sure we snap to whole window pixels. ptTablet.Y = (int)Math.Round(ptTablet.Y); - ptTablet = _stylusLogic.MeasureUnitsFromDeviceUnits(stylusDevice.CriticalActiveSource, ptTablet); // change to measured units now. + ptTablet = _stylusLogic.MeasureUnitsFromDeviceUnits(inputReport.InputSource ?? stylusDevice.CriticalActiveSource, ptTablet); // change to measured units now. pic = HittestPlugInCollection(ptTablet); // Use cached rectangles for UIElements. }