macOS: Handle momentum scroll NSEventPhaseBegan when scroll had ended
We use nextEventMatchingMask to look for future momentum scroll events when the non-momentum scroll ends, to continue the scroll uninterrupted from the perspective of client code. But we're not guaranteed to find a future momentum scroll event, as observed on macOS 12.1, so if we then see a momentum NSEventPhaseBegan we need to treat it as a scroll begin from Qt's perspective. Fixes: QTBUG-97841 Change-Id: I412abe0891660eda32a42a08d7dc7dee9eaa73aa Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 2e1191845679b937bed5f04979287c26e5578e76) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
f9cd2235c3
commit
58226a8b62
@ -725,7 +725,11 @@ static const QPointingDevice *pointingDeviceFor(qint64 deviceID)
|
||||
}
|
||||
} else if (theEvent.momentumPhase == NSEventPhaseBegan) {
|
||||
Q_ASSERT(!pixelDelta.isNull() && !angleDelta.isNull());
|
||||
phase = Qt::ScrollUpdate; // Send as update, it has a delta
|
||||
// If we missed finding a momentum NSEventPhaseBegan when the non-momentum
|
||||
// phase ended we need to treat this as a scroll begin, to not confuse client
|
||||
// code. Otherwise we treat it as a continuation of the existing scroll.
|
||||
phase = m_scrolling ? Qt::ScrollUpdate : Qt::ScrollBegin;
|
||||
m_scrolling = true;
|
||||
} else if (theEvent.momentumPhase == NSEventPhaseChanged) {
|
||||
phase = Qt::ScrollMomentum;
|
||||
} else if (theEvent.phase == NSEventPhaseCancelled
|
||||
|
Loading…
x
Reference in New Issue
Block a user