From 7ec96eaab618013065c8a648c5be83775caee6ea Mon Sep 17 00:00:00 2001 From: lindexi Date: Thu, 30 Jul 2026 10:45:17 +0800 Subject: [PATCH] Apply changes from https://github.com/dotnet/wpf/pull/11124 Source-PR: https://github.com/dotnet/wpf/pull/11124 Source-Head-SHA: 6e23ef8c4d4a5c10d7cadeda53290dc2d0020148 --- .../System/Windows/Input/Stylus/Wisp/WispLogic.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Wisp/WispLogic.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Wisp/WispLogic.cs index bc8acaa9e..a6115fdbb 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Wisp/WispLogic.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Wisp/WispLogic.cs @@ -3124,10 +3124,8 @@ internal bool Enabled } ///////////////////////////////////////////////////////////////////// - internal void RegisterHwndForInput(InputManager inputManager, PresentationSource inputSource) + internal void RegisterHwndForInput(InputManager inputManager, HwndSource hwndSource) { - HwndSource hwndSource = (HwndSource)inputSource; - GetAndCacheTransformToDeviceMatrix(hwndSource); // Keep track so we don't bother looking for changes if someone happened to query this before @@ -3139,14 +3137,14 @@ internal void RegisterHwndForInput(InputManager inputManager, PresentationSource lock (__penContextsLock) { - if (__penContextsMap.ContainsKey(inputSource)) + if (__penContextsMap.ContainsKey(hwndSource)) { throw new InvalidOperationException(SR.PenService_WindowAlreadyRegistered); } - PenContexts penContexts = new PenContexts(StylusLogic.GetCurrentStylusLogicAs(), inputSource); + PenContexts penContexts = new PenContexts(StylusLogic.GetCurrentStylusLogicAs(), hwndSource); - __penContextsMap[inputSource] = penContexts; + __penContextsMap[hwndSource] = penContexts; // If FIRST one set this as the one to manage TabletAdded/Removed notifications. if (__penContextsMap.Count == 1)