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

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