on xenial help sign in
fixes left edge drag when in spread

don't allow to drag an application to the left while in spread always focus the dash on long left edge swipes Fixes: #1371872 Approved by: Andrea Cimitan

commit458bd19a20d651a4a7f5a6bdf704acf5a85c8dbc authorMichael Zanetti <michael.zanetti@canonical.com> dateFri 23 Jan 2015, 12:11 (12 years ago) parentcb65cefda6b900
3 files changed+28−4
qml/Stages/PhoneStage.qml+2−2 qml/Stages/TabletStage.qml+2−2 tests/qmltests/Stages/tst_PhoneStage.qml+24
qml/Stages/PhoneStage.qml+2−2
@@ -52,7 +52,7 @@ Rectangle {
5252 if (inverseProgress == 0 && priv.oldInverseProgress > 0) {
5353 // left edge drag released. Minimum distance is given by design.
5454 if (priv.oldInverseProgress > units.gu(22)) {
55− ApplicationManager.focusApplication("unity8-dash");
55+ ApplicationManager.requestFocusApplication("unity8-dash");
5656 }
5757 }
5858 priv.oldInverseProgress = inverseProgress;
@@ -299,7 +299,7 @@ Rectangle {
299299 x: {
300300 // focused app is always positioned at 0 except when following left edge drag
301301 if (index == 0) {
302− if (!isDash && root.inverseProgress > 0) {
302+ if (!isDash && root.inverseProgress > 0 && spreadView.phase === 0) {
303303 return root.inverseProgress;
304304 }
305305 return 0;
qml/Stages/TabletStage.qml+2−2
@@ -43,7 +43,7 @@ Rectangle {
4343 if (inverseProgress == 0 && priv.oldInverseProgress > 0) {
4444 // left edge drag released. Minimum distance is given by design.
4545 if (priv.oldInverseProgress > units.gu(22)) {
46− ApplicationManager.focusApplication("unity8-dash");
46+ ApplicationManager.requestFocusApplication("unity8-dash");
4747 }
4848 }
4949 priv.oldInverseProgress = inverseProgress;
@@ -492,7 +492,7 @@ Rectangle {
492492 interactive: !spreadView.interactive && spreadView.phase === 0 && root.interactive
493493 swipeToCloseEnabled: spreadView.interactive && !snapAnimation.running
494494 maximizedAppTopMargin: root.maximizedAppTopMargin
495− dragOffset: !isDash && model.appId == priv.mainStageAppId && root.inverseProgress > 0 ? root.inverseProgress : 0
495+ dragOffset: !isDash && model.appId == priv.mainStageAppId && root.inverseProgress > 0 && spreadView.phase === 0 ? root.inverseProgress : 0
496496 application: ApplicationManager.get(index)
497497 closeable: !isDash
498498
tests/qmltests/Stages/tst_PhoneStage.qml+24
@@ -394,5 +394,29 @@ Item {
394394
395395 tryCompare(spreadView, "contentX", -spreadView.shift)
396396 }
397+
398+ function test_leftEdge_data() {
399+ return [
400+ { tag: "normal", inSpread: false, leftEdgeDragWidth: units.gu(5), shouldMoveApp: true },
401+ { tag: "inSpread", inSpread: true, leftEdgeDragWidth: units.gu(5), shouldMoveApp: false }
402+ ]
403+ }
404+
405+ function test_leftEdge(data) {
406+ addApps(2);
407+
408+ if (data.inSpread) {
409+ goToSpread();
410+ }
411+
412+ var focusedDelegate = findChild(phoneStage, "appDelegate0");
413+ phoneStage.inverseProgress = data.leftEdgeDragWidth;
414+
415+ tryCompare(focusedDelegate, "x", data.shouldMoveApp ? data.leftEdgeDragWidth : 0);
416+
417+ phoneStage.inverseProgress = 0;
418+
419+ tryCompare(focusedDelegate, "x", 0);
420+ }
397421 }
398422}