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 cebca075a2d..a6a4b072706 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 @@ -3137,10 +3137,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 @@ -3152,14 +3150,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)