Skip to content

Commit

Permalink
Mark stationary touch points as updated if pressure or velocity changes
Browse files Browse the repository at this point in the history
This is to inform Qt Quick when a stationary touchpoint is delivered
that it is because of a changed property. Qt Quick still needs to avoid
delivering item-customized events (with only the touch points that occur
inside the item) that contain only stationary touch points without
changed properties. To be able to check this private flag,
QQuickPointerTouchEvent needs to be a friend.

Task-number: QTBUG-77142
Change-Id: I6ee0dffbbeca9e513c77227b757252e2eec6a4ef
Reviewed-by: Tor Arne Vestbø <[email protected]>
  • Loading branch information
ec1oud authored and torarnv committed Sep 17, 2019
1 parent ff8e7fd commit 217dd1b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/gui/kernel/qevent.h
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,7 @@ class Q_GUI_EXPORT QTouchEvent : public QInputEvent
friend class QGuiApplicationPrivate;
friend class QApplication;
friend class QApplicationPrivate;
friend class QQuickPointerTouchEvent;
};

#if QT_DEPRECATED_SINCE(5, 0)
Expand Down
4 changes: 3 additions & 1 deletion src/gui/kernel/qevent_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ class QTouchEventTouchPointPrivate
state(Qt::TouchPointReleased),
pressure(-1),
rotation(0),
ellipseDiameters(0, 0)
ellipseDiameters(0, 0),
stationaryWithModifiedProperty(false)
{ }

inline QTouchEventTouchPointPrivate *detach()
Expand All @@ -91,6 +92,7 @@ class QTouchEventTouchPointPrivate
QSizeF ellipseDiameters;
QVector2D velocity;
QTouchEvent::TouchPoint::InfoFlags flags;
bool stationaryWithModifiedProperty : 1;
QVector<QPointF> rawScreenPositions;
};

Expand Down
2 changes: 2 additions & 0 deletions src/gui/kernel/qguiapplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2843,10 +2843,12 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
if (touchPoint.state() == Qt::TouchPointStationary) {
if (touchInfo.touchPoint.velocity() != touchPoint.velocity()) {
touchInfo.touchPoint.setVelocity(touchPoint.velocity());
touchPoint.d->stationaryWithModifiedProperty = true;
stationaryTouchPointChangedProperty = true;
}
if (!qFuzzyCompare(touchInfo.touchPoint.pressure(), touchPoint.pressure())) {
touchInfo.touchPoint.setPressure(touchPoint.pressure());
touchPoint.d->stationaryWithModifiedProperty = true;
stationaryTouchPointChangedProperty = true;
}
} else {
Expand Down

0 comments on commit 217dd1b

Please sign in to comment.