You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
WPF will have a touch offset after trun on the WM_Pointer message #3360
Does the bug reproduce also in WPF for .NET Framework 4.8?: Yes
Problem description:
I don’t know how to turn on WM_Pointer message under .NET Core 3.1, but I can turn on WM_Pointer message under .NET Framework 4.7.2
After the Pointer message is turned on, the coordinates of the GetStylusPoints points I obtained in the StylusMove event are incorrect, and there is a big error with the coordinates of the correct point.
Actual behavior:
My application works well at a resolution of 1920x1080, but at a resolution of 800x600, problems will occur.
The behavior of the application is that when using touch to draw handwriting, the handwriting drawn by the application does not coincide with my actual touch track
As shown below
Expected behavior:
I expect to draw the same effect under Pointer as without using Pointer
If the ActiveSource was somehow incorrect, you'd end up with an identity matrix, which might be causing the issue, but I'd have to debug it to find out.
Just some rapid fire questions to help narrow down exactly what is happening:
Are you changing resolutions on a single monitor system and then re-running the application?
Changing resolutions on a single monitor system with the app still running?
In a multi-monitor setup with two resolutions and moving the window across?
@lindexiThis is probably the best set of instructions for enabling AppContext flags on core that I have seen. You can set any AppContext flags that might be useful (including Switch.System.Windows.Input.Stylus.EnablePointerSupport).
It's really odd that just a resolution change causes this problem. I'm not sure exactly what is going on, perhaps there is an error in the initial creation of the stylus points for inking. Most of that work is done here:
I'd have to dig a lot deeper into the code and debug to understand exactly what is going on though. There are multiple places where the matrix may be incorrectly created, but that's where I would start.
Activity
rladuca commentedon Aug 21, 2020
Hmm, not sure if this has anything to do with #2891. The pointer stack is, generally, always querying the active source for transformation matrices, so I am not sure why this would break with a resolution change.
If the ActiveSource was somehow incorrect, you'd end up with an identity matrix, which might be causing the issue, but I'd have to debug it to find out.
Just some rapid fire questions to help narrow down exactly what is happening:
lindexi commentedon Aug 21, 2020
@rladuca Thank you.
I change the resolutions and then I reboot the device and then re-running the application on a single monitor.
lindexi commentedon Aug 21, 2020
@rladuca How can I turn on the WM_Pointer in .NET Core application?
rladuca commentedon Aug 21, 2020
@lindexi This is probably the best set of instructions for enabling AppContext flags on core that I have seen. You can set any AppContext flags that might be useful (including
Switch.System.Windows.Input.Stylus.EnablePointerSupport).It's really odd that just a resolution change causes this problem. I'm not sure exactly what is going on, perhaps there is an error in the initial creation of the stylus points for inking. Most of that work is done here:
wpf/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/InterOp/HwndPointerInputProvider.cs
Line 141 in 1ee7587
It's possible the origin offset are incorrect:
wpf/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/InterOp/HwndPointerInputProvider.cs
Line 326 in 1ee7587
I'd have to dig a lot deeper into the code and debug to understand exactly what is going on though. There are multiple places where the matrix may be incorrectly created, but that's where I would start.