diff options
author | Dominik Holland <dominik.holland@pelagicore.com> | 2016-06-07 11:06:30 +0200 |
---|---|---|
committer | Jani Heikkinen <jani.heikkinen@qt.io> | 2016-06-07 11:50:36 +0000 |
commit | 9c714358b6a99e9e1517bdf5495ccda99408d553 (patch) | |
tree | f1572d35e2660348da64648b572164843f158b78 | |
parent | 0918ffa9f32a6ff59f101ffd80c2325f2fbd0e6d (diff) |
QtCompositor: Fixed touch point handling
When touch event sending was enabled for the surface the compositor
crashed because the resource where not bound and the checks for the
pointer were wrong.
Task-number: QTBUG-53886
Change-Id: I3720c773cbe30354bb4fe3789e26a8901e676049
Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Kalle Viironen <kalle.viironen@theqtcompany.com>
-rw-r--r-- | src/compositor/compositor_api/qwaylandtouch.cpp | 9 | ||||
-rw-r--r-- | src/compositor/compositor_api/qwaylandtouch_p.h | 1 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/compositor/compositor_api/qwaylandtouch.cpp b/src/compositor/compositor_api/qwaylandtouch.cpp index 63b0f84ea..a9b44527e 100644 --- a/src/compositor/compositor_api/qwaylandtouch.cpp +++ b/src/compositor/compositor_api/qwaylandtouch.cpp @@ -60,6 +60,11 @@ void QWaylandTouchPrivate::resetFocusState() focusResource = 0; } +void QWaylandTouchPrivate::touch_bind_resource(Resource *resource) +{ + focusResource = resource; +} + void QWaylandTouchPrivate::touch_destroy_resource(Resource *resource) { if (focusResource == resource) { @@ -75,7 +80,7 @@ void QWaylandTouchPrivate::touch_release(Resource *resource) void QWaylandTouchPrivate::sendDown(uint32_t time, int touch_id, const QPointF &position) { Q_Q(QWaylandTouch); - if (focusResource || q->mouseFocus()) + if (!focusResource || !q->mouseFocus()) return; uint32_t serial = q->compositor()->nextSerial(); @@ -86,7 +91,7 @@ void QWaylandTouchPrivate::sendDown(uint32_t time, int touch_id, const QPointF & void QWaylandTouchPrivate::sendUp(uint32_t time, int touch_id) { - if (focusResource) + if (!focusResource) return; uint32_t serial = compositor()->nextSerial(); diff --git a/src/compositor/compositor_api/qwaylandtouch_p.h b/src/compositor/compositor_api/qwaylandtouch_p.h index 3c9e0ec93..ea334eea1 100644 --- a/src/compositor/compositor_api/qwaylandtouch_p.h +++ b/src/compositor/compositor_api/qwaylandtouch_p.h @@ -88,6 +88,7 @@ public: } private: void resetFocusState(); + void touch_bind_resource(Resource *resource) Q_DECL_OVERRIDE; void touch_destroy_resource(Resource *resource) Q_DECL_OVERRIDE; void touch_release(Resource *resource) Q_DECL_OVERRIDE; |