on xenial help sign in
DDA - ungrab current mouse grabber instead of going all the way grabbing for himself
6e35e1eDaniel d'Andrada
plugins/Ubuntu/Gestures/DirectionalDragArea.cpp+4−2
@@ -253,6 +253,7 @@ void DirectionalDragArea::touchOwnershipEvent(TouchOwnershipEvent *event)
253 if (event->gained()) {
253 if (event->gained()) {
254 QVector<int> ids;
254 QVector<int> ids;
255 ids.append(event->touchId());
255 ids.append(event->touchId());
256+ DDA_DEBUG("grabbing touch");
256 grabTouchPoints(ids);
257 grabTouchPoints(ids);
257
258
258 // Work around for Qt bug. If we grab a touch that is being used for mouse pointer
259 // Work around for Qt bug. If we grab a touch that is being used for mouse pointer
@@ -261,8 +262,9 @@ void DirectionalDragArea::touchOwnershipEvent(TouchOwnershipEvent *event)
261 // TODO: Report bug to Qt
262 // TODO: Report bug to Qt
262 if (window()) {
263 if (window()) {
263 QQuickWindowPrivate *windowPrivate = QQuickWindowPrivate::get(window());
264 QQuickWindowPrivate *windowPrivate = QQuickWindowPrivate::get(window());
264− if (windowPrivate->touchMouseId == event->touchId()) {
265+ if (windowPrivate->touchMouseId == event->touchId() && window()->mouseGrabberItem()) {
265− grabMouse();
266+ DDA_DEBUG("removing mouse grabber");
267+ window()->mouseGrabberItem()->ungrabMouse();
266 }
268 }
267 }
269 }
268 } else {
270 } else {
tests/qmltests/tst_Shell.qml−11
@@ -139,17 +139,6 @@ Row {
139
139
140 var launcher = findChild(shell, "launcher");
140 var launcher = findChild(shell, "launcher");
141 launcherShowDashHomeSpy.target = launcher;
141 launcherShowDashHomeSpy.target = launcher;
142−
143− // For some reason, grabbing touches cause MouseArea.mouseX and mouseY
144− // to contain wrong info during test runs, which then makes tests fail.
145− // Therefore we have to avoid grabbing touches to work around this bug
146− // (still to be further investigated and reported).
147− //
148− // Make the left-edge drag area immediately recognize touches that land on it
149− // thus avoing the DirectionalDragArea from grabbing the touch later on.
150− var launcherDragArea = findChild(launcher, "launcherDragArea");
151− launcherDragArea.distanceThreshold = 0
152− launcherDragArea.compositionTime = 0
153 }
142 }
154
143
155 function cleanup() {
144 function cleanup() {