From 2aeb8d151fd17410b46b524da40d8d2b2dd39f05 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 https://github.com/dotnet/wpf/issues/11103 --- .../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 aa1ed22602c..7056049ace1 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. using System.Windows.Input.StylusWisp; @@ -488,7 +488,7 @@ internal StylusPlugInCollection TargetPlugInCollection(RawStylusInputReport inpu 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. }