diff options
author | Daniel d'Andrada <daniel.dandrada@gmail.com> | 2017-08-07 10:20:09 -0300 |
---|---|---|
committer | Daniel d'Andrada <daniel.dandrada@gmail.com> | 2017-08-08 10:51:46 +0000 |
commit | 809e567e4edd45aed15166593997b2217c35e87a (patch) | |
tree | c4ccc614f0a7949e53b62c1d7d7b5e6d2b5cd5a8 | |
parent | 22e6316fbbe35d0a26a75871772f64894db46379 (diff) | |
download | neptune-ui-809e567e4edd45aed15166593997b2217c35e87a.tar.gz |
Fix application switching (window stack)
This fixes use cases like this:
- launch i18n demo
- back
- launch radio
- click on the app switcher on the top right
- click on the i18n demo thumbnail
expected outcome:
you get i18n demo on foreground
buggy outcome (ie, without this fix):
you get radio again
Change-Id: I9610da4649b7e0ee61791f69f8d92353b2162c07
Reviewed-by: Nedim Hadzic <nedim.hadzic@pelagicore.com>
Reviewed-by: Bramastyo Harimukti Santoso <bramastyo.harimukti.santoso@pelagicore.com>
-rw-r--r-- | sysui/display/Display.qml | 2 | ||||
-rw-r--r-- | sysui/display/LaunchController.qml | 31 |
2 files changed, 25 insertions, 8 deletions
diff --git a/sysui/display/Display.qml b/sysui/display/Display.qml index 2448760..861bc7c 100644 --- a/sysui/display/Display.qml +++ b/sysui/display/Display.qml @@ -73,7 +73,7 @@ Item { onLoaded: { homePage.anchors.topMargin = 0 menuScreenLoader.item.homePage = homePage - launcherControllerLoader.item.stackView.push(menuScreenLoader.item) + launcherControllerLoader.item.homePage = menuScreenLoader.item StagedStartupModel.enterFinalState() } } diff --git a/sysui/display/LaunchController.qml b/sysui/display/LaunchController.qml index 9f048cc..10a9424 100644 --- a/sysui/display/LaunchController.qml +++ b/sysui/display/LaunchController.qml @@ -38,12 +38,20 @@ import utils 1.0 import models.application 1.0 import models.system 1.0 +/* + A window stack with the home page at the bottom and at most an application window on top of it +*/ Item { id: root width: Style.screenWidth height: Style.vspan(20) - property alias stackView: stackView + property Item homePage + onHomePageChanged: { + if (homePage) { + stackView.push(homePage); + } + } StackView { id: stackView @@ -113,6 +121,9 @@ Item { } } + replaceEnter: popEnter + replaceExit: popExit + Item { id: dummyitem anchors.fill: parent @@ -129,21 +140,27 @@ Item { target: ApplicationManagerModel onApplicationSurfaceReady: { - //Make sure to push the items only once - for (var i = 1; i < stackView.depth; ++i) { - if (stackView.get(i) === item) - return + if (stackView.currentItem === item) { + // NOOP + return; } if (isMinimized) { item.parent = dummyitem } else { - stackView.push(item, {"width": Style.hspan(24), "height": Style.vspan(24)}) + var parameters = {"width": Style.hspan(24), "height": Style.vspan(24)}; + if (stackView.depth === 1) { + stackView.push(item, parameters) + } else if (stackView.depth > 1) { + stackView.replace(item, parameters) + } } } onReleaseApplicationSurface: { - stackView.pop() + if (stackView.currentItem === item) { + stackView.pop() + } } onUnhandledSurfaceReceived: { |