on xenial help sign in
DDA - ungrab current mouse grabber instead of going all the way grabbing for himself
commit6e35e1ebaa01716183a2f08b3b146278b7a54a40 authorDaniel d'Andrada <daniel.dandrada@canonical.com> dateThu 9 Oct 2014, 15:58 (12 years ago) parent87c2ff8
2 files changed+4−13
plugins/Ubuntu/Gestures/DirectionalDragArea.cpp+4−2 tests/qmltests/tst_Shell.qml−11
plugins/Ubuntu/Gestures/DirectionalDragArea.cpp+4−2
@@ -253,6 +253,7 @@ void DirectionalDragArea::touchOwnershipEvent(TouchOwnershipEvent *event)
253253 if (event->gained()) {
254254 QVector<int> ids;
255255 ids.append(event->touchId());
256+ DDA_DEBUG("grabbing touch");
256257 grabTouchPoints(ids);
257258
258259 // 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)
261262 // TODO: Report bug to Qt
262263 if (window()) {
263264 QQuickWindowPrivate *windowPrivate = QQuickWindowPrivate::get(window());
264− if (windowPrivate->touchMouseId == event->touchId()) {
265− grabMouse();
265+ if (windowPrivate->touchMouseId == event->touchId() && window()->mouseGrabberItem()) {
266+ DDA_DEBUG("removing mouse grabber");
267+ window()->mouseGrabberItem()->ungrabMouse();
266268 }
267269 }
268270 } else {
tests/qmltests/tst_Shell.qml−11
@@ -139,17 +139,6 @@ Row {
139139
140140 var launcher = findChild(shell, "launcher");
141141 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
153142 }
154143
155144 function cleanup() {