on xenial help sign in
Use a MouseArea to eat touch events while edge gesture, because the second touch point will cause the valuse of contendX of the spreadView unpredictable
459eec4handsome_feng
qml/Stages/PhoneStage.qml+8−1
@@ -319,7 +319,7 @@ Rectangle {
319 otherSelected: spreadView.selectedIndex >= 0 && !selected
319 otherSelected: spreadView.selectedIndex >= 0 && !selected
320 interactive: !spreadView.interactive && spreadView.phase === 0
320 interactive: !spreadView.interactive && spreadView.phase === 0
321 && spreadView.shiftedContentX === 0 && root.interactive && isFocused
321 && spreadView.shiftedContentX === 0 && root.interactive && isFocused
322− swipeToCloseEnabled: !spreadDragArea.dragging && spreadView.interactive && root.interactive && !snapAnimation.running
322+ swipeToCloseEnabled: spreadView.interactive && root.interactive && !snapAnimation.running
323 maximizedAppTopMargin: root.maximizedAppTopMargin
323 maximizedAppTopMargin: root.maximizedAppTopMargin
324 dropShadow: spreadView.active ||
324 dropShadow: spreadView.active ||
325 (priv.focusedAppDelegate && priv.focusedAppDelegate.x !== 0)
325 (priv.focusedAppDelegate && priv.focusedAppDelegate.x !== 0)
@@ -449,6 +449,13 @@ Rectangle {
449 }
449 }
450 }
450 }
451
451
452+ //eat touch events during the right edge gesture
453+ MouseArea {
454+ objectName: "MouseArea"
455+ anchors.fill: parent
456+ enabled: spreadDragArea.dragging
457+ }
458+
452 DirectionalDragArea {
459 DirectionalDragArea {
453 id: spreadDragArea
460 id: spreadDragArea
454 objectName: "spreadDragArea"
461 objectName: "spreadDragArea"
qml/Stages/TabletStage.qml+7−1
@@ -503,7 +503,7 @@ Rectangle {
503 otherSelected: spreadView.selectedIndex >= 0 && !selected
503 otherSelected: spreadView.selectedIndex >= 0 && !selected
504 isInSideStage: priv.sideStageAppId == model.appId
504 isInSideStage: priv.sideStageAppId == model.appId
505 interactive: !spreadView.interactive && spreadView.phase === 0 && root.interactive
505 interactive: !spreadView.interactive && spreadView.phase === 0 && root.interactive
506− swipeToCloseEnabled: !spreadDragArea.dragging && spreadView.interactive && !snapAnimation.running
506+ swipeToCloseEnabled: spreadView.interactive && !snapAnimation.running
507 maximizedAppTopMargin: root.maximizedAppTopMargin
507 maximizedAppTopMargin: root.maximizedAppTopMargin
508 dragOffset: !isDash && model.appId == priv.mainStageAppId && root.inverseProgress > 0 && spreadView.phase === 0 ? root.inverseProgress : 0
508 dragOffset: !isDash && model.appId == priv.mainStageAppId && root.inverseProgress > 0 && spreadView.phase === 0 ? root.inverseProgress : 0
509 application: ApplicationManager.get(index)
509 application: ApplicationManager.get(index)
@@ -597,6 +597,12 @@ Rectangle {
597 }
597 }
598 }
598 }
599
599
600+ //eat touch events during the right edge gesture
601+ MouseArea {
602+ anchors.fill: parent
603+ enabled: spreadDragArea.dragging
604+ }
605+
600 DirectionalDragArea {
606 DirectionalDragArea {
601 id: spreadDragArea
607 id: spreadDragArea
602 anchors { top: parent.top; right: parent.right; bottom: parent.bottom }
608 anchors { top: parent.top; right: parent.right; bottom: parent.bottom }
tests/qmltests/Stages/tst_PhoneStage.qml+4−13
@@ -399,14 +399,9 @@ Item {
399 tryCompare(spreadView, "contentX", -spreadView.shift)
399 tryCompare(spreadView, "contentX", -spreadView.shift)
400 }
400 }
401
401
402− function test_cantCloseAppWhileRightEdgeGesture() {
402+ function test_cantAccessPhoneStageWhileRightEdgeGesture() {
403− addApps(2)
404−
405 var spreadView = findChild(phoneStage, "spreadView");
403 var spreadView = findChild(phoneStage, "spreadView");
406−
404+ var mouseArea = findChild(phoneStage, "MouseArea")
407− var app0 = findChild(spreadView, "appDelegate0");
408− var app1 = findChild(spreadView, "appDelegate1");
409− var app2 = findChild(spreadView, "appDelegate2");
410
405
411 var startX = phoneStage.width - 2;
406 var startX = phoneStage.width - 2;
412 var startY = phoneStage.height / 2;
407 var startY = phoneStage.height / 2;
@@ -416,15 +411,11 @@ Item {
416 touchFlick(phoneStage, startX, startY, endX, endY,
411 touchFlick(phoneStage, startX, startY, endX, endY,
417 true /* beginTouch */, false /* endTouch */, units.gu(10), 50);
412 true /* beginTouch */, false /* endTouch */, units.gu(10), 50);
418
413
419− tryCompare(app0, "swipeToCloseEnabled", false);
414+ compare(mouseArea.enabled, true);
420− tryCompare(app1, "swipeToCloseEnabled", false);
421− tryCompare(app2, "swipeToCloseEnabled", false);
422
415
423 touchRelease(phoneStage, endX, endY);
416 touchRelease(phoneStage, endX, endY);
424
417
425− tryCompare(app0,"swipeToCloseEnabled", true);
418+ compare(mouseArea.enabled, false);
426− tryCompare(app1, "swipeToCloseEnabled", true);
427− tryCompare(app2, "swipeToCloseEnabled", true);
428 }
419 }
429
420
430 function test_leftEdge_data() {
421 function test_leftEdge_data() {