Fix incorrect touch point coordinates when running application on secondary screen with WM_Pointer enabled #11051
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #8517
Main PR
Description
In the GetOriginOffsetsLogical method, the expected behavior is to return coordinates relative to the current screen. However, due to Windows' mechanism, when operating on a non-primary screen, the method returns coordinates relative to the primary screen. This leads to issue #8517. The fix involves subtracting the Left and Top values of displayRect during the calculation, ensuring that the resulting coordinates are relative to the current screen rather than the primary screen, thereby resolving the touch offset problem.
Customer Impact
Fix the bug.
Regression
Testing
The dotnet-campus#9 was tested for two years in many my users device. And this PR is pick from dotnet-campus#9
Risk
Low. For the vast majority of users, this has no impact. Most users have only a single touchscreen, in which case the displayRect's Left and Top values are both zero. This means that point.x - displayRect.left and point.y - displayRect.top will not alter the x and y values of the point.
Microsoft Reviewers: Open in CodeFlow