Comment 4 for bug 1459362

Revision history for this message
Olivier Tilloy (osomon) wrote : Re: SwipeArea lets touch events through when a drag is detected

I’ve now updated my branch to use the public SwipeArea component from the UITK, and I’m still seeing an issue similar to the one originally reported. I can reproduce it with a minimal standalone example:

import QtQuick 2.4
import Ubuntu.Components 1.3
import com.canonical.Oxide 1.11
WebView {
  url: "https://en.wikipedia.org/wiki/Ubuntu_(operating_system)"
  SwipeArea {
    direction: SwipeArea.Upwards
    onDraggingChanged: console.log("dragging:", dragging)
    onDistanceChanged: console.log("distance:", distance)
    anchors {
      left: parent.left
      right: parent.right
      bottom: parent.bottom
    }
    height: units.gu(2)
  }
}

I instrumented oxide to print a log statement every time a touch event is detected, and when starting a drag even from the bottom edge, the following happens:

qml: distance: 0
virtual void OxideQQuickWebView::touchEvent(QTouchEvent*) QTouchEvent(TouchBegin states: QFlags(0x1), 1 points: (TouchPoint(0 QRectF(599.979,1848.5 2.9974x2.9974) pressed)))
virtual void OxideQQuickWebView::touchEvent(QTouchEvent*) QTouchEvent(TouchUpdate states: QFlags(0x2), 1 points: (TouchPoint(0 QRectF(613.967,1676.09 2.9974x1.99827) moved)))
virtual void OxideQQuickWebView::touchEvent(QTouchEvent*) QTouchEvent(TouchUpdate states: QFlags(0x2), 1 points: (TouchPoint(0 QRectF(618.213,1623.12 4.99566x2.9974) moved)))
virtual void OxideQQuickWebView::touchEvent(QTouchEvent*) QTouchEvent(TouchUpdate states: QFlags(0x2), 1 points: (TouchPoint(0 QRectF(620.961,1507.47 2.9974x1.99827) moved)))
virtual void OxideQQuickWebView::touchEvent(QTouchEvent*) QTouchEvent(TouchUpdate states: QFlags(0x2), 1 points: (TouchPoint(0 QRectF(620.961,1492.02 2.9974x1.99827) moved)))
qml: dragging: true
qml: distance: 148.6371093749999
[…]
qml: distance: 513.631586442578
qml: dragging: false

It appears the webview is getting a TouchBegin event, followed by a number of TouchUpdate events, before the SwipeArea even detects a drag. When it does, events stop being sent to the webview, which as a consequence never gets a TouchEnd event to match the first TouchBegin event, leaving it in an inconsistent state.