Bug 1892537 - Set mIsPrimary by pointer ID only for touch input a=RyanVM

It only make sense for touch input, as touch pointer ID always restarts from 0 while pen pointer ID always increments.

This won't work if there are multiple active pens, but that's rare enough and not straightforward to fix as somehow sActivePointersIds gets pointerId=0 instead of actual pointer ID for pens.

Original Revision: https://phabricator.services.mozilla.com/D214978

Differential Revision: https://phabricator.services.mozilla.com/D219698
This commit is contained in:
Kagami Sascha Rosylight 2024-08-20 22:59:23 +00:00
parent 8dc476b8d0
commit e3844abe87

View file

@ -564,10 +564,14 @@ void PointerEventHandler::InitPointerEventFromTouch(
? aTouchEvent.mButtons
: MouseButtonsFlag::ePrimaryFlag;
// Only the first touch would be the primary pointer.
aPointerEvent.mIsPrimary = aTouchEvent.mMessage == eTouchStart
? !HasActiveTouchPointer()
: GetPointerPrimaryState(aTouch.Identifier());
// XXX: This doesn't support multi pen scenario (bug 1904865)
if (aTouchEvent.mInputSource == MouseEvent_Binding::MOZ_SOURCE_TOUCH) {
// Only the first touch would be the primary pointer.
aPointerEvent.mIsPrimary =
aTouchEvent.mMessage == eTouchStart
? !HasActiveTouchPointer()
: GetPointerPrimaryState(aTouch.Identifier());
}
aPointerEvent.pointerId = aTouch.Identifier();
aPointerEvent.mRefPoint = aTouch.mRefPoint;
aPointerEvent.mModifiers = aTouchEvent.mModifiers;