on xenial help sign in
Child surface support
46981c2Nick Dedekind
data/unity8.conf+3
@@ -44,6 +44,8 @@ pre-start script
44 rm "$MIR_SERVER_FILE"
44 rm "$MIR_SERVER_FILE"
45 fi
45 fi
46
46
47+ initctl set-env --global MIR_SERVER_PROMPT_FILE=1
48+
47 initctl emit scope-ui-starting
49 initctl emit scope-ui-starting
48 initctl emit --no-wait indicator-services-start
50 initctl emit --no-wait indicator-services-start
49end script
51end script
@@ -53,4 +55,5 @@ exec ${BINARY:-unity8} $ARGS
53post-stop script
55post-stop script
54 initctl set-env --global MIR_SOCKET=$UNITY_MIR_SOCKET
56 initctl set-env --global MIR_SOCKET=$UNITY_MIR_SOCKET
55 initctl unset-env --global UNITY_MIR_SOCKET
57 initctl unset-env --global UNITY_MIR_SOCKET
58+ initctl unset-env --global MIR_SERVER_PROMPT_FILE
56end script
59end script
qml/Stages/SpreadDelegate.qml+2−6
@@ -35,10 +35,10 @@ Item {
35 signal clicked()
35 signal clicked()
36 signal closed()
36 signal closed()
37
37
38− Item {
38+ SurfaceContainer {
39 id: surfaceContainer
39 id: surfaceContainer
40 anchors.fill: parent
40 anchors.fill: parent
41− readonly property var surface: model.surface
41+ surface: model.surface
42 property bool appHasCreatedASurface: false
42 property bool appHasCreatedASurface: false
43
43
44 onSurfaceChanged: {
44 onSurfaceChanged: {
@@ -47,11 +47,7 @@ Item {
47 surface.visible = false; // hide until splash screen removed
47 surface.visible = false; // hide until splash screen removed
48 appHasCreatedASurface = true;
48 appHasCreatedASurface = true;
49 }
49 }
50−
51− surface.parent = surfaceContainer;
52− surface.anchors.fill = surfaceContainer;
53 surfaceContainer.checkFullscreen(surface);
50 surfaceContainer.checkFullscreen(surface);
54− surface.z = 1;
55 }
51 }
56 }
52 }
57
53
qml/Stages/SurfaceContainer.qmlnew file+95
@@ -0,0 +1,95 @@
1+/*
2+ * Copyright 2014 Canonical Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU Lesser General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU Lesser General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU Lesser General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+*/
16+
17+import QtQuick 2.0
18+
19+Item {
20+ id: container
21+ property Item surface: null
22+ property string animation
23+ property bool show: false
24+
25+ onSurfaceChanged: {
26+ if (surface) {
27+ surface.parent = container;
28+ surface.anchors.fill = container;
29+ surface.z = 1;
30+ }
31+ }
32+
33+ Repeater {
34+ model: container.surface ? container.surface.childSurfaces : 0
35+
36+ delegate: Loader {
37+ z: 2
38+ anchors.fill: surface
39+
40+ // Only way to do recursive qml items.
41+ source: Qt.resolvedUrl("SurfaceContainer.qml")
42+ onLoaded: {
43+ item.parent = container.surface;
44+ item.surface = modelData;
45+ item.animation = "overlaySwipeBottom"
46+ item.show = true;
47+ }
48+ }
49+ }
50+
51+ states: [
52+ State {
53+ name: "baseAnimation"
54+ PropertyChanges { target: surface; anchors.fill: undefined }
55+ },
56+
57+ State {
58+ name: "overlaySwipeBottom-out"
59+ extend: "baseAnimation"
60+ when: surface && animation === "overlaySwipeBottom" && !show
61+ AnchorChanges { target: surface; anchors.top: surface.parent.bottom }
62+ },
63+ State {
64+ name: "overlaySwipeBottom-in"
65+ extend: "baseAnimation"
66+ when: surface && animation === "overlaySwipeBottom" && show
67+ AnchorChanges { target: surface; anchors.top: surface.parent.top }
68+ }
69+
70+ // TODO: more animations!
71+ // Surface needs to stick around so that we can dimiss them with animation.
72+ ]
73+
74+ transitions: [
75+ Transition {
76+ from: "overlaySwipeBottom-out"
77+ to: "overlaySwipeBottom-in"
78+ SequentialAnimation {
79+ PropertyAction { target: surface.parent; property: "clip"; value: true}
80+ AnchorAnimation { easing.type: Easing.InOutQuad; duration: 400 }
81+ PropertyAction { target: surface.parent; property: "clip"; value: false}
82+ }
83+ },
84+ Transition {
85+ from: "overlaySwipeBottom-in"
86+ to: "overlaySwipeBottom-out"
87+ SequentialAnimation {
88+ PropertyAction { target: surface.parent; property: "clip"; value: true}
89+ AnchorAnimation { easing.type: Easing.InOutQuad; duration: 400 }
90+ PropertyAction { target: surface; property: "visible"; value: false}
91+ PropertyAction { target: surface.parent; property: "clip"; value: false}
92+ }
93+ }
94+ ]
95+}