summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2017-01-10 12:26:26 +0100
committerJohan Helsing <johan.helsing@qt.io>2017-01-12 12:13:03 +0000
commitfd310aac0486ac26076e0aea87f6f8e0ed9aa542 (patch)
treeeac37cd2f53019f40bbeaf7e17f8160a4b00f55f
parent5e6259b09326022324709c44ad533d004056e048 (diff)
Send touch cancel event when QWaylandQuickItem::visible is set to false
Task-number: QTBUG-57927 Change-Id: I8b6a5aaa9337222286382ffbeee13b794bec125c Reviewed-by: Jan Arne Petersen <jan.petersen@kdab.com> Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
-rw-r--r--src/compositor/compositor_api/qwaylandquickitem.cpp14
-rw-r--r--src/compositor/compositor_api/qwaylandquickitem.h3
-rw-r--r--src/compositor/compositor_api/qwaylandquickitem_p.h1
3 files changed, 17 insertions, 1 deletions
diff --git a/src/compositor/compositor_api/qwaylandquickitem.cpp b/src/compositor/compositor_api/qwaylandquickitem.cpp
index 9ec000c84..dc7b6b067 100644
--- a/src/compositor/compositor_api/qwaylandquickitem.cpp
+++ b/src/compositor/compositor_api/qwaylandquickitem.cpp
@@ -660,6 +660,12 @@ void QWaylandQuickItem::touchEvent(QTouchEvent *event)
}
seat->sendFullTouchEvent(surface(), event);
+ if (event->type() == QEvent::TouchBegin) {
+ d->touchingSeats.append(seat);
+ } else if (event->type() == QEvent::TouchEnd || event->type() == QEvent::TouchCancel) {
+ d->touchingSeats.removeOne(seat);
+ }
+
if (event->type() == QEvent::TouchBegin && d->focusOnClick)
takeFocus(seat);
} else {
@@ -667,6 +673,14 @@ void QWaylandQuickItem::touchEvent(QTouchEvent *event)
}
}
+void QWaylandQuickItem::touchUngrabEvent()
+{
+ Q_D(QWaylandQuickItem);
+ for (auto seat : d->touchingSeats)
+ seat->sendTouchCancelEvent(surface()->client());
+ d->touchingSeats.clear();
+}
+
#if QT_CONFIG(im)
/*!
* \internal
diff --git a/src/compositor/compositor_api/qwaylandquickitem.h b/src/compositor/compositor_api/qwaylandquickitem.h
index 87d10b024..04f33db67 100644
--- a/src/compositor/compositor_api/qwaylandquickitem.h
+++ b/src/compositor/compositor_api/qwaylandquickitem.h
@@ -133,7 +133,8 @@ protected:
void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
- void touchEvent(QTouchEvent *event) Q_DECL_OVERRIDE;
+ void touchEvent(QTouchEvent *event) override;
+ void touchUngrabEvent() override;
#if QT_CONFIG(im)
void inputMethodEvent(QInputMethodEvent *event) Q_DECL_OVERRIDE;
diff --git a/src/compositor/compositor_api/qwaylandquickitem_p.h b/src/compositor/compositor_api/qwaylandquickitem_p.h
index f597f8d3e..18693a738 100644
--- a/src/compositor/compositor_api/qwaylandquickitem_p.h
+++ b/src/compositor/compositor_api/qwaylandquickitem_p.h
@@ -178,6 +178,7 @@ public:
QQuickWindow *connectedWindow;
QWaylandSurface::Origin origin;
QPointer<QObject> subsurfaceHandler;
+ QVector<QWaylandSeat *> touchingSeats;
};
QT_END_NAMESPACE