Skip to content

WPF will have a touch offset after trun on the WM_Pointer message #3360

Open

Description

@lindexi
  • .NET Core Version: 3.1.301
  • Windows version: (winver)
  • 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

Minimal repro:

https://github.com/lindexi/lindexi_gd/tree/ae335e8d83a0fbc6297dc2a9196577e5c3319b22/KemjawyecawDurbahelal

Activity

  1. rladuca commented on Aug 21, 2020

    @rladuca
    Member

    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:

    • 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?
  2. lindexi commented on Aug 21, 2020

    @lindexi
    MemberAuthor

    @rladuca Thank you.

    I change the resolutions and then I reboot the device and then re-running the application on a single monitor.

  3. lindexi commented on Aug 21, 2020

    @lindexi
    MemberAuthor

    @rladuca How can I turn on the WM_Pointer in .NET Core application?

  4. rladuca commented on Aug 21, 2020

    @rladuca
    Member

    @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:

    private int[] GenerateRawStylusData(PointerData pointerData, PointerTabletDevice tabletDevice)

    It's possible the origin offset are incorrect:

    private void GetOriginOffsetsLogical(out int originOffsetX, out int originOffsetY)

    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.

  5. added
    Bug
    on Aug 24, 2020
  6. added this to the Future milestone on Aug 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugarea-Touch

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions