on xenial help sign in
make side stage behave better
commitc12a6df4f2a7880c3a3f2eef9e4d0c3b5a9f8701 authorMichael Zanetti <michael.zanetti@canonical.com> dateTue 26 Jul 2016, 14:47 (10 years ago) parent0ce698c
1 file changed+35−2
qml/Stages/DesktopStage.qml+35−2
qml/Stages/DesktopStage.qml+35−2
@@ -165,6 +165,12 @@ AbstractStage {
165165 property string mainStageAppId: ""
166166 property string sideStageAppId: ""
167167
168+ onSideStageDelegateChanged: {
169+ if (!sideStageDelegate) {
170+ sideStage.hide();
171+ }
172+ }
173+
168174 function updateMainAndSideStageIndexes() {
169175 print("updating stage indexes, sideStage shown:", sideStage.shown)
170176 var choseMainStage = false;
@@ -176,7 +182,7 @@ AbstractStage {
176182 for (var i = 0; i < appRepeater.count && (!choseMainStage || !choseSideStage); ++i) {
177183 var appDelegate = appRepeater.itemAt(i);
178184 print("have app on stage", appDelegate.applicationId, appDelegate.stage)
179− if (sideStage.shown && appDelegate.stage == ApplicationInfoInterface.SideStage
185+ if (/*sideStage.shown && */appDelegate.stage == ApplicationInfoInterface.SideStage
180186 && !choseSideStage) {
181187 priv.sideStageDelegate = appDelegate
182188 priv.sideStageItemId = root.topLevelSurfaceList.idAt(i);
@@ -405,6 +411,28 @@ AbstractStage {
405411 return 2;
406412 }
407413
414+
415+ onShownChanged: {
416+ print("sidestage shown changed:", shown)
417+ if (!shown && priv.mainStageDelegate) {
418+ priv.mainStageDelegate.claimFocus();
419+ }
420+ }
421+
422+// onShownChanged: {
423+// if (!shown && priv.sideStageDelegate && priv.focusedAppDelegate === priv.sideStageDelegate) {
424+// priv.updateMainAndSideStageIndexes();
425+// if (priv.mainStageDelegate) {
426+// priv.mainStageDelegate.focus = true;
427+// }
428+// } else if (shown) {
429+// priv.updateMainAndSideStageIndexes();
430+// if (priv.sideStageDelegate) {
431+// priv.sideStageDelegate.focus = true;
432+// }
433+// }
434+// }
435+
408436 DropArea {
409437 id: sideStageDropArea
410438 objectName: "SideStageDropArea"
@@ -545,6 +573,10 @@ AbstractStage {
545573
546574 function claimFocus() {
547575 appDelegate.focus = true;
576+ print("focusing app", priv.sideStageDelegate, appDelegate, sideStage.shown)
577+ if (appDelegate.stage == ApplicationInfoInterface.SideStage && !sideStage.shown) {
578+ sideStage.show();
579+ }
548580 }
549581 Connections {
550582 target: model.surface
@@ -847,7 +879,7 @@ AbstractStage {
847879 y: appDelegate.fullscreen ? 0 : PanelState.panelHeight
848880 z: stageMaths.itemZ
849881 requestedWidth: stageMaths.itemWidth
850− requestedHeight: appContainer.height - PanelState.panelHeight
882+ requestedHeight: appDelegate.fullscreen ? appContainer.height : appContainer.height - PanelState.panelHeight
851883 visuallyMaximized: true
852884 }
853885 PropertyChanges {
@@ -1004,6 +1036,7 @@ AbstractStage {
10041036 Transition {
10051037 to: "spread"
10061038 // DecoratedWindow wants the sceleToPreviewSize set before enabling scaleToPreview
1039+ PropertyAction { target: appDelegate; property: "z" }
10071040 PropertyAction { target: decoratedWindow; property: "scaleToPreviewSize" }
10081041 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,height"; duration: priv.animationDuration }
10091042 UbuntuNumberAnimation { target: decoratedWindow; properties: "width,height,itemScale,angle,scaleToPreviewProgress"; duration: priv.animationDuration }