fix: use IsPrimary() for touch pointer isPrimary instead of hardcoded id#16099
Open
gmacmaster wants to merge 2 commits intomicrosoft:mainfrom
Open
fix: use IsPrimary() for touch pointer isPrimary instead of hardcoded id#16099gmacmaster wants to merge 2 commits intomicrosoft:mainfrom
gmacmaster wants to merge 2 commits intomicrosoft:mainfrom
Conversation
… ID check (#4) activeTouch.isPrimary was set via `pointerId == 1`, which only works for mouse (MOUSE_POINTER_ID == 1). Windows touch pointer IDs are OS-allocated and essentially never 1, so isPrimary was always false for touch input. This meant touch pointers never triggered onClick (gated behind isPrimary && button == 0) and reported incorrect isPrimary in PointerEvents sent to JS. Replace with pointerPoint.Properties().IsPrimary(), which reads the OS POINTER_FLAG_PRIMARY flag directly. This API is already used elsewhere in the codebase (SwitchComponentView, WindowsTextInputComponentView, Composition.Input). (The diagnostics are pre-existing clang noise from missing PCH/Windows headers — not related to this change.)
Contributor
|
/azp run |
Contributor
|
Azure Pipelines successfully started running 1 pipeline(s). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
activeTouch.isPrimary was set via
pointerId == 1, which only works formouse (MOUSE_POINTER_ID == 1). Windows touch pointer IDs are OS-allocated
and essentially never 1, so isPrimary was always false for touch input.
This meant touch pointers never triggered onClick (gated behind
isPrimary && button == 0) and reported incorrect isPrimary in
PointerEvents sent to JS.
Type of Change
Why
Replace with pointerPoint.Properties().IsPrimary(), which reads the OS
POINTER_FLAG_PRIMARY flag directly. This API is already used elsewhere
in the codebase (SwitchComponentView, WindowsTextInputComponentView,
Composition.Input).
Resolves: N/a
What
Today, touch fingers never trigger onClick (because isPrimary is always false). After the fix, the primary finger would. Combined with secondary fix 1 above, those new clicks would be dispatched correctly per W3C — but they are still new dispatches that did not happen before. That is a behaviour change worth its own changeset, its own review, and its own test pass.
Changelog
Should this change be included in the release notes: yes
fix: use IsPrimary() for touch pointer isPrimary instead of hardcoded pointer ID check
Microsoft Reviewers: Open in CodeFlow