Skip to content

Commit 6e23ef8

Browse files
committed
Pass the HwndSource parameters directly
The RegisterHwndForInput only be called by `HwndStylusInputProvider..ctor`. And the `HwndStylusInputProvider..ctor` will pass the `HwndSource source` to RegisterHwndForInput method. So that it unnecessary to use the PresentationSource in RegisterHwndForInput.
1 parent b4d57bf commit 6e23ef8

File tree

1 file changed

+4
-6
lines changed
  • src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Wisp

1 file changed

+4
-6
lines changed

src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Wisp/WispLogic.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3137,10 +3137,8 @@ internal bool Enabled
31373137
}
31383138

31393139
/////////////////////////////////////////////////////////////////////
3140-
internal void RegisterHwndForInput(InputManager inputManager, PresentationSource inputSource)
3140+
internal void RegisterHwndForInput(InputManager inputManager, HwndSource hwndSource)
31413141
{
3142-
HwndSource hwndSource = (HwndSource)inputSource;
3143-
31443142
GetAndCacheTransformToDeviceMatrix(hwndSource);
31453143

31463144
// 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
31523150

31533151
lock (__penContextsLock)
31543152
{
3155-
if (__penContextsMap.ContainsKey(inputSource))
3153+
if (__penContextsMap.ContainsKey(hwndSource))
31563154
{
31573155
throw new InvalidOperationException(SR.PenService_WindowAlreadyRegistered);
31583156
}
31593157

3160-
PenContexts penContexts = new PenContexts(StylusLogic.GetCurrentStylusLogicAs<WispLogic>(), inputSource);
3158+
PenContexts penContexts = new PenContexts(StylusLogic.GetCurrentStylusLogicAs<WispLogic>(), hwndSource);
31613159

3162-
__penContextsMap[inputSource] = penContexts;
3160+
__penContextsMap[hwndSource] = penContexts;
31633161

31643162
// If FIRST one set this as the one to manage TabletAdded/Removed notifications.
31653163
if (__penContextsMap.Count == 1)

0 commit comments

Comments
 (0)