From fd310aac0486ac26076e0aea87f6f8e0ed9aa542 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 10 Jan 2017 12:26:26 +0100 Subject: Send touch cancel event when QWaylandQuickItem::visible is set to false Task-number: QTBUG-57927 Change-Id: I8b6a5aaa9337222286382ffbeee13b794bec125c Reviewed-by: Jan Arne Petersen Reviewed-by: Paul Olav Tvete Reviewed-by: Shawn Rutledge --- src/compositor/compositor_api/qwaylandquickitem.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/compositor/compositor_api/qwaylandquickitem.cpp') 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 -- cgit v1.2.3