Blame SOURCES/0015-Fix-TapHandler-so-that-it-actually-registers-a-tap.patch

77f9a9
From 743ae2a4d59eccc4720390c4c757b081eb2c6bfa Mon Sep 17 00:00:00 2001
77f9a9
From: =?UTF-8?q?Jan=20Arve=20S=C3=A6ther?= <jan-arve.saether@qt.io>
77f9a9
Date: Thu, 3 Sep 2020 10:51:01 +0200
77f9a9
Subject: [PATCH 15/20] Fix TapHandler so that it actually registers a tap
77f9a9
77f9a9
This bug caused all quick examples that used the
77f9a9
shared\LauncherList.qml to be broken.
77f9a9
77f9a9
In QtGui, QSinglePointEvent will construct itself with a point id of 0
77f9a9
if there is a valid point, and with a point id of -1 if the point is
77f9a9
invalid (the default constructor does the latter).
77f9a9
However, QQuickSinglePointHandler::wantsPointerEvent() did not agree
77f9a9
with that, because it assumed that a point id of 0 meant
77f9a9
uninitialized/invalid point.
77f9a9
The fix is to change QQuickSinglePointHandler::wantsPointerEvent() and
77f9a9
QQuickHandlerPoint so that it assumes that the id -1 is now an invalid
77f9a9
point, (instead of 0)
77f9a9
77f9a9
Change-Id: I8c9683dfe06ebb77c5342a26f08174b67e7cbd90
77f9a9
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
77f9a9
(cherry picked from commit 8d3a91016506fd0afedb0be535f7c34a4ca762f6)
77f9a9
---
77f9a9
 src/quick/handlers/qquickhandlerpoint.cpp       | 4 ++--
77f9a9
 src/quick/handlers/qquicksinglepointhandler.cpp | 4 ++--
77f9a9
 2 files changed, 4 insertions(+), 4 deletions(-)
77f9a9
77f9a9
diff --git a/src/quick/handlers/qquickhandlerpoint.cpp b/src/quick/handlers/qquickhandlerpoint.cpp
77f9a9
index 72efdfd0f4..6aef3545dd 100644
77f9a9
--- a/src/quick/handlers/qquickhandlerpoint.cpp
77f9a9
+++ b/src/quick/handlers/qquickhandlerpoint.cpp
77f9a9
@@ -82,7 +82,7 @@ void QQuickHandlerPoint::localize(QQuickItem *item)
77f9a9
 
77f9a9
 void QQuickHandlerPoint::reset()
77f9a9
 {
77f9a9
-    m_id = 0;
77f9a9
+    m_id = -1;
77f9a9
     m_uniqueId = QPointingDeviceUniqueId();
77f9a9
     m_position = QPointF();
77f9a9
     m_scenePosition = QPointF();
77f9a9
@@ -165,7 +165,7 @@ void QQuickHandlerPoint::reset(const QVector<QQuickHandlerPoint> &points)
77f9a9
         pressureSum += point.pressure();
77f9a9
         ellipseDiameterSum += point.ellipseDiameters();
77f9a9
     }
77f9a9
-    m_id = 0;
77f9a9
+    m_id = -1;
77f9a9
     m_uniqueId = QPointingDeviceUniqueId();
77f9a9
     // all points are required to be from the same event, so pressed buttons and modifiers should be the same
77f9a9
     m_pressedButtons = points.first().pressedButtons();
77f9a9
diff --git a/src/quick/handlers/qquicksinglepointhandler.cpp b/src/quick/handlers/qquicksinglepointhandler.cpp
77f9a9
index b51f53b74f..89081b4e84 100644
77f9a9
--- a/src/quick/handlers/qquicksinglepointhandler.cpp
77f9a9
+++ b/src/quick/handlers/qquicksinglepointhandler.cpp
77f9a9
@@ -75,7 +75,7 @@ bool QQuickSinglePointHandler::wantsPointerEvent(QQuickPointerEvent *event)
77f9a9
     if (!QQuickPointerDeviceHandler::wantsPointerEvent(event))
77f9a9
         return false;
77f9a9
 
77f9a9
-    if (d->pointInfo.id()) {
77f9a9
+    if (d->pointInfo.id() != -1) {
77f9a9
         // We already know which one we want, so check whether it's there.
77f9a9
         // It's expected to be an update or a release.
77f9a9
         // If we no longer want it, cancel the grab.
77f9a9
@@ -125,7 +125,7 @@ bool QQuickSinglePointHandler::wantsPointerEvent(QQuickPointerEvent *event)
77f9a9
             chosen->setAccepted();
77f9a9
         }
77f9a9
     }
77f9a9
-    return d->pointInfo.id();
77f9a9
+    return d->pointInfo.id() != -1;
77f9a9
 }
77f9a9
 
77f9a9
 void QQuickSinglePointHandler::handlePointerEventImpl(QQuickPointerEvent *event)
77f9a9
-- 
77f9a9
2.35.1
77f9a9