on xenial help sign in
exit spread on background tap Fixes: 1368261
036c964Michael Zanetti
qml/Stages/PhoneStage.qml+6−1
@@ -246,12 +246,13 @@ Rectangle {
246 }
246 }
247 }
247 }
248
248
249− Item {
249+ MouseArea {
250 id: spreadRow
250 id: spreadRow
251 // This width controls how much the spread can be flicked left/right. It's composed of:
251 // This width controls how much the spread can be flicked left/right. It's composed of:
252 // tileDistance * app count (with a minimum of 3 apps, in order to also allow moving 1 and 2 apps a bit)
252 // tileDistance * app count (with a minimum of 3 apps, in order to also allow moving 1 and 2 apps a bit)
253 // + some constant value (still scales with the screen width) which looks good and somewhat fills the screen
253 // + some constant value (still scales with the screen width) which looks good and somewhat fills the screen
254 width: Math.max(3, ApplicationManager.count) * spreadView.tileDistance + (spreadView.width - spreadView.tileDistance) * 1.5
254 width: Math.max(3, ApplicationManager.count) * spreadView.tileDistance + (spreadView.width - spreadView.tileDistance) * 1.5
255+ height: parent.height
255 Behavior on width {
256 Behavior on width {
256 enabled: spreadView.closingIndex >= 0
257 enabled: spreadView.closingIndex >= 0
257 UbuntuNumberAnimation {}
258 UbuntuNumberAnimation {}
@@ -264,6 +265,10 @@ Rectangle {
264
265
265 x: spreadView.contentX
266 x: spreadView.contentX
266
267
268+ onClicked: {
269+ spreadView.snapTo(0);
270+ }
271+
267 Repeater {
272 Repeater {
268 id: spreadRepeater
273 id: spreadRepeater
269 model: ApplicationManager
274 model: ApplicationManager
qml/Stages/TabletStage.qml+5−1
@@ -386,12 +386,16 @@ Rectangle {
386 }
386 }
387 }
387 }
388
388
389− Item {
389+ MouseArea {
390 id: spreadRow
390 id: spreadRow
391 x: spreadView.contentX
391 x: spreadView.contentX
392 height: root.height
392 height: root.height
393 width: spreadView.width + Math.max(spreadView.width, ApplicationManager.count * spreadView.tileDistance)
393 width: spreadView.width + Math.max(spreadView.width, ApplicationManager.count * spreadView.tileDistance)
394
394
395+ onClicked: {
396+ spreadView.snapTo(0);
397+ }
398+
395 Rectangle {
399 Rectangle {
396 id: sideStageBackground
400 id: sideStageBackground
397 color: "black"
401 color: "black"
tests/qmltests/Stages/tst_PhoneStage.qml+17
@@ -314,6 +314,23 @@ Item {
314 tryCompare(app, "orientation", Qt.LandscapeOrientation);
314 tryCompare(app, "orientation", Qt.LandscapeOrientation);
315 }
315 }
316
316
317+ function test_backgroundClickCancelsSpread() {
318+ addApps(3);
319+
320+ var focusedAppId = ApplicationManager.focusedApplicationId;
321+
322+ goToSpread();
323+
324+ mouseClick(phoneStage, units.gu(1), units.gu(1));
325+
326+ // Make sure the spread is in the idle position
327+ var spreadView = findChild(phoneStage, "spreadView");
328+ tryCompare(spreadView, "contentX", -spreadView.shift);
329+
330+ // Make sure the same app is still focused
331+ compare(focusedAppId, ApplicationManager.focusedApplicationId);
332+ }
333+
317 function cleanup() {
334 function cleanup() {
318 while (ApplicationManager.count > 1) {
335 while (ApplicationManager.count > 1) {
319 var oldCount = ApplicationManager.count;
336 var oldCount = ApplicationManager.count;