diff options
author | Andreas Hartmetz <andreas.hartmetz@kdab.com> | 2015-09-23 17:19:17 +0200 |
---|---|---|
committer | Andreas Hartmetz <ahartmetz@gmail.com> | 2015-09-25 12:52:32 +0000 |
commit | 2336c5d726892d38592bc2d0c3f1a3c5a3640a0c (patch) | |
tree | 21bc9cdd26f5b63526706bbafe6459002ecd5b2f | |
parent | cf91dd10ff02916bace9281b0bfce02933e92814 (diff) |
QWaylandSurfaceItem: ungrab the pointer on TouchEnd event.
The unconditional grab from 498946d6e9c20d4e8af28ee942de5bf4cf5eaf78
did not have a corresponding ungrab. That only worked well as long as
there were only QWaylandSurfaceItems in the scene. Each of them just
stole the grab for itself at the first TouchBegin. Regular QML items
(some people have UI in the compositor process...) do not participate
in that mutual stealing so they'd sometimes not get any touch events
because the events still went to the last QWaylandSurfaceItem to
receive a TouchBegin.
Note: The grab would also go away if touchEvent() didn't accept()
the event. Without the accept(),
QQuickWindowPrivate::translateTouchToMouse()
would be called at TouchEnd and do the ungrab.
Change-Id: Ia7d1b15fff366542d382eb97494b1e43dedb65a4
Reviewed-by: Andrew den Exter <andrew.den.exter@qinetic.com.au>
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
-rw-r--r-- | src/compositor/compositor_api/qwaylandsurfaceitem.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/compositor/compositor_api/qwaylandsurfaceitem.cpp b/src/compositor/compositor_api/qwaylandsurfaceitem.cpp index 93cfaf008..fddf34f5e 100644 --- a/src/compositor/compositor_api/qwaylandsurfaceitem.cpp +++ b/src/compositor/compositor_api/qwaylandsurfaceitem.cpp @@ -250,6 +250,10 @@ void QWaylandSurfaceItem::touchEvent(QTouchEvent *event) inputDevice->setMouseFocus(this, pointPos, pointPos); } inputDevice->sendFullTouchEvent(event); + + const bool isEnd = event->type() == QEvent::TouchEnd || event->type() == QEvent::TouchCancel; + if (isEnd && window()->mouseGrabberItem() == this) + ungrabMouse(); } else { event->ignore(); } |