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

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