@@ -17,7 +17,7 @@
17import QtQuick 2.0
17import QtQuick 2.0
18import AccountsService 0.1
18import AccountsService 0.1
19import GSettings 1.0
19import GSettings 1.0
20−import Unity.Application 0.1
20+import Mir.Application 0.1
21import Ubuntu.Components 0.1
21import Ubuntu.Components 0.1
22import Ubuntu.Gestures 0.1
22import Ubuntu.Gestures 0.1
23import Unity.Launcher 0.1
23import Unity.Launcher 0.1
@@ -30,6 +30,7 @@ import "Launcher"
30import "Panel"
30import "Panel"
31import "Components"
31import "Components"
32import "Notifications"
32import "Notifications"
33import Unity.Notifications 1.0 as NotificationBackend
34import Unity.Notifications 1.0 as NotificationBackend
35FocusScope {
36FocusScope {
@@ -48,19 +49,14 @@ FocusScope {
48 property bool dashShown: dash.shown
49 property bool dashShown: dash.shown
50 property bool sideStageEnabled: shell.width >= units.gu(100)
51 property bool sideStageEnabled: shell.width >= units.gu(100)
51− readonly property string focusedApplicationId: ApplicationManager.focusedApplicationId
53 function activateApplication(appId) {
53 function activateApplication(appId) {
54 if (ApplicationManager.findApplication(appId)) {
54 if (ApplicationManager.findApplication(appId)) {
55 ApplicationManager.requestFocusApplication(appId);
55 ApplicationManager.requestFocusApplication(appId);
57− if (stages.locked && ApplicationManager.focusedApplicationId == appId) {
58− applicationsDisplayLoader.item.select(appId);
61 var execFlags = shell.sideStageEnabled ? ApplicationManager.NoFlag : ApplicationManager.ForceMainStage;
57 var execFlags = shell.sideStageEnabled ? ApplicationManager.NoFlag : ApplicationManager.ForceMainStage;
62 ApplicationManager.startApplication(appId, execFlags);
58 ApplicationManager.startApplication(appId, execFlags);
63− stages.show(false);
59+ stages.show();
@@ -91,87 +87,65 @@ FocusScope {
91 Keys.onVolumeDownPressed: volumeControl.volumeDown()
87 Keys.onVolumeDownPressed: volumeControl.volumeDown()
94− id: underlayClipper
90+ id: underlay
91+ objectName: "underlay"
95 anchors.fill: parent
92 anchors.fill: parent
96− anchors.rightMargin: stages.overlayWidth
97− clip: stages.overlayMode && !stages.painting
99− InputFilterArea {
94+ // Whether the underlay is fully covered by opaque UI elements.
100− anchors.fill: parent
95+ property bool fullyCovered: panel.indicators.fullyOpened && shell.width <= panel.indicatorsMenuWidth
101− blockInput: parent.clip
104− Item {
97+ // NB! Application surfaces are stacked behind the shell one. So they can only be seen by the user
105− id: underlay
98+ // through the translucent parts of the shell surface.
106− objectName: "underlay"
99+ visible: !fullyCovered
107− anchors.fill: parent
108− anchors.rightMargin: -parent.anchors.rightMargin
110− // Whether the underlay is fully covered by opaque UI elements.
101+ CrossFadeImage {
111− property bool fullyCovered: panel.indicators.fullyOpened && shell.width <= panel.indicatorsMenuWidth
102+ id: backgroundImage
103+ objectName: "backgroundImage"
113− // Whether the user should see the topmost application surface (if there's one at all).
105+ anchors.fill: parent
114− readonly property bool applicationSurfaceShouldBeSeen: stages.shown && !stages.painting && !stages.overlayMode
106+ source: shell.background
107+ fillMode: Image.PreserveAspectCrop
116− // NB! Application surfaces are stacked behind the shell one. So they can only be seen by the user
110+ Rectangle {
117− // through the translucent parts of the shell surface.
111+ anchors.fill: parent
118− visible: !fullyCovered && !applicationSurfaceShouldBeSeen
112+ color: "black"
113+ opacity: dash.disappearingAnimationProgress
120− CrossFadeImage {
116+ Image {
121− id: backgroundImage
117+ anchors.fill: dash
122− objectName: "backgroundImage"
118+ source: shell.width > shell.height ? "Dash/graphics/paper_landscape.png" : "Dash/graphics/paper_portrait.png"
119+ fillMode: Image.PreserveAspectCrop
120+ horizontalAlignment: Image.AlignRight
121+ verticalAlignment: Image.AlignTop
124− anchors.fill: parent
124+ Dash {
125− source: shell.background
125+ id: dash
126− fillMode: Image.PreserveAspectCrop
126+ objectName: "dash"
129− Rectangle {
128+ available: !greeter.shown && !lockscreen.shown
130− anchors.fill: parent
129+ hides: [stages, launcher, panel.indicators]
131− color: "black"
130+ shown: disappearingAnimationProgress !== 1.0 && greeterWrapper.showProgress !== 1.0
132− opacity: dash.disappearingAnimationProgress
131+ enabled: disappearingAnimationProgress === 0.0 && greeterWrapper.showProgress === 0.0 && edgeDemo.dashEnabled
135− Image {
133+ anchors {
136− anchors.fill: dash
134+ fill: parent
137− source: shell.width > shell.height ? "Dash/graphics/paper_landscape.png" : "Dash/graphics/paper_portrait.png"
135+ topMargin: panel.panelHeight
138− fillMode: Image.PreserveAspectCrop
139− horizontalAlignment: Image.AlignRight
140− verticalAlignment: Image.AlignTop
147− available: !greeter.shown && !lockscreen.shown
148− hides: [stages, launcher, panel.indicators]
149− shown: disappearingAnimationProgress !== 1.0 && greeterWrapper.showProgress !== 1.0
150− enabled: disappearingAnimationProgress === 0.0 && greeterWrapper.showProgress === 0.0 && edgeDemo.dashEnabled
154− topMargin: panel.panelHeight
157− contentScale: 1.0 - 0.2 * disappearingAnimationProgress
138+ contentScale: 1.0 - 0.2 * disappearingAnimationProgress
158− opacity: 1.0 - disappearingAnimationProgress
139+ opacity: 1.0 - disappearingAnimationProgress
159− property real disappearingAnimationProgress: {
140+ property real disappearingAnimationProgress: stages.showProgress
160− if (stages.overlayMode) {
163− return stages.showProgress
167− // FIXME: only necessary because stages.showProgress is not animated
142+ // FIXME: only necessary because stages.showProgress is not animated
168− Behavior on disappearingAnimationProgress { SmoothedAnimation { velocity: 5 }}
143+ Behavior on disappearingAnimationProgress { SmoothedAnimation { velocity: 5 }}
173 EdgeDragArea {
147 EdgeDragArea {
174− id: stagesDragHandle
148+ id: stagesDragArea
175 direction: Direction.Leftwards
149 direction: Direction.Leftwards
177 anchors { top: parent.top; right: parent.right; bottom: parent.bottom }
151 anchors { top: parent.top; right: parent.right; bottom: parent.bottom }
@@ -181,99 +155,50 @@ FocusScope {
182 onTouchXChanged: {
156 onTouchXChanged: {
183 if (status == DirectionalDragArea.Recognized) {
157 if (status == DirectionalDragArea.Recognized) {
184− if (ApplicationManager.count == 0) {
158+ if (stages.empty) {
185− progress = Math.max(stages.width - stagesDragHandle.width + touchX, stages.width * .3)
159+ progress = Math.max(stages.width - stagesDragArea.width + touchX, stages.width * .3);
187− progress = stages.width - stagesDragHandle.width + touchX
161+ progress = stages.width - stagesDragArea.width + touchX;
192 onDraggingChanged: {
166 onDraggingChanged: {
193 if (!dragging) {
167 if (!dragging) {
194− if (ApplicationManager.count > 0 && progress < stages.width - units.gu(10)) {
168+ if (!stages.empty && progress < stages.width - units.gu(10)) {
195− stages.show(true)
169+ stages.show();
197− stagesDragHandle.progress = stages.width;
171+ stagesDragArea.progress = stages.width;
202− Item {
176+ Rectangle {
203 id: stages
177 id: stages
204 objectName: "stages"
178 objectName: "stages"
205 width: parent.width
179 width: parent.width
206 height: parent.height
180 height: parent.height
210− if (overlayMode || locked) {
213− return launcher.progress
183+ x: shown ? launcher.progress : stagesDragArea.progress
215− return stagesDragHandle.progress
219 Behavior on x { SmoothedAnimation { velocity: 600; duration: UbuntuAnimation.FastDuration } }
184 Behavior on x { SmoothedAnimation { velocity: 600; duration: UbuntuAnimation.FastDuration } }
221 property bool shown: false
186 property bool shown: false
223− property real showProgress: overlayMode ? 0 : MathUtils.clamp(1 - x / shell.width, 0, 1)
188+ property real showProgress: MathUtils.clamp(1 - x / shell.width, 0, 1)
225 property bool fullyShown: x == 0
190 property bool fullyShown: x == 0
226 property bool fullyHidden: x == width
191 property bool fullyHidden: x == width
228− property bool painting: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.painting : false
193+ property bool empty: SurfaceManager.count == 0
229− property bool fullscreen: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.fullscreen : false
230− property bool overlayMode: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.overlayMode : false
231− property int overlayWidth: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.overlayWidth : false
232− property bool locked: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.locked : false
234− function show(focusApp) {
195+ function show() {
235 shown = true;
196 shown = true;
236− panel.indicators.hide();
197+// panel.indicators.hide();
237− edgeDemo.stopDemo();
239− if (!ApplicationManager.focusedApplicationId && ApplicationManager.count > 0 && focusApp) {
240− ApplicationManager.focusApplication(ApplicationManager.get(0).appId);
244 function hide() {
200 function hide() {
245 shown = false;
201 shown = false;
246− if (ApplicationManager.focusedApplicationId) {
247− ApplicationManager.unfocusCurrentApplication();
252− target: ApplicationManager
258− onFocusedApplicationIdChanged: {
259− if (ApplicationManager.focusedApplicationId.length > 0) {
262− if (!stages.overlayMode) {
268− onApplicationAdded: {
272− onApplicationRemoved: {
273− if (ApplicationManager.focusedApplicationId.length == 0) {
@@ -284,13 +209,8 @@ FocusScope {
285 Binding {
210 Binding {
286 target: applicationsDisplayLoader.item
211 target: applicationsDisplayLoader.item
287− property: "moving"
212+ property: "surfaces"
288− value: !stages.fullyShown
213+ value: SurfaceManager
291− target: applicationsDisplayLoader.item
295 Binding {
215 Binding {
296 target: applicationsDisplayLoader.item
216 target: applicationsDisplayLoader.item
@@ -300,6 +220,32 @@ FocusScope {
228+ target: SurfaceManager
230+ if (surface.type == MirSurfaceItem.InputMethod) {
231+ inputMethod.surface = surface;
237+ onSurfaceDestroyed: {
238+ var orphan = !surface.parent;
239+ if (inputMethod.surface == surface) {
240+ inputMethod.removeSurface(surface);
243+ // there's no one displaying it. delete it right away
303 Lockscreen {
249 Lockscreen {
304 id: lockscreen
250 id: lockscreen
305 objectName: "lockscreen"
251 objectName: "lockscreen"
@@ -419,12 +365,6 @@ FocusScope {
423− anchors.fill: parent
424− blockInput: ApplicationManager.focusedApplicationId.length === 0 || greeter.shown || lockscreen.shown || launcher.shown
425− || panel.indicators.shown
428 Connections {
368 Connections {
429 id: powerConnection
369 id: powerConnection
430 target: Powerd
370 target: Powerd
@@ -472,28 +412,9 @@ FocusScope {
473 property string focusedAppId: ApplicationManager.focusedApplicationId
413 property string focusedAppId: ApplicationManager.focusedApplicationId
474 property var focusedApplication: ApplicationManager.findApplication(focusedAppId)
414 property var focusedApplication: ApplicationManager.findApplication(focusedAppId)
475− fullscreenMode: focusedApplication && stages.fullscreen && !greeter.shown && !lockscreen.shown
415+ //fullscreenMode: focusedApplication && stages.fullscreen && !greeter.shown && !lockscreen.shown
416+ fullscreenMode: focusedApplication && !greeter.shown && !lockscreen.shown
476 searchVisible: !greeter.shown && !lockscreen.shown && dash.shown && dash.searchable
417 searchVisible: !greeter.shown && !lockscreen.shown && dash.shown && dash.searchable
484− height: (panel.fullscreenMode) ? shell.edgeSize : panel.panelHeight
490− blockInput: launcher.shown
493− bottom: parent.bottom
496− width: launcher.width
499 Launcher {
420 Launcher {
@@ -514,11 +435,9 @@ FocusScope {
514 showHome()
435 showHome()
516 onDash: {
437 onDash: {
517− if (stages.shown && !stages.overlayMode) {
518− if (!stages.locked) {
438+ if (!stages.locked) {
519− stages.hide();
439+ stages.hide();
520− launcher.hide();
440+ launcher.hide();
523 if (greeter.shown) {
442 if (greeter.shown) {
524 greeter.hideRight();
443 greeter.hideRight();
@@ -548,11 +467,6 @@ FocusScope {
548 MouseArea {
467 MouseArea {
549 anchors.fill: parent
468 anchors.fill: parent
553− anchors.fill: parent
554− blockInput: modalNotificationBackground.visible
558 Notifications {
472 Notifications {
@@ -580,59 +494,18 @@ FocusScope {
580 PropertyChanges { target: notifications; width: units.gu(38) }
494 PropertyChanges { target: notifications; width: units.gu(38) }
585− anchors { left: parent.left; right: parent.right }
586− height: parent.contentHeight
587− blockInput: height > 0
592 focus: true
500 focus: true
593 onFocusChanged: if (!focus) forceActiveFocus();
501 onFocusChanged: if (!focus) forceActiveFocus();
598− bottom: parent.bottom
601− width: shell.edgeSize
608− bottom: parent.bottom
611− width: shell.edgeSize
615 Binding {
503 Binding {
616 target: i18n
504 target: i18n
617 property: "domain"
505 property: "domain"
618 value: "unity8"
506 value: "unity8"
622− anchors.topMargin: panel.panelHeight
623− anchors.fill: parent // as needs to know the geometry of the shell
626− //FIXME: This should be handled in the input stack, keyboard shouldnt propagate
628− anchors.bottom: parent.bottom
629− anchors.left: parent.left
630− anchors.right: parent.right
631− height: ApplicationManager.keyboardVisible ? ApplicationManager.keyboardHeight : 0
633− enabled: ApplicationManager.keyboardVisible
637 anchors.centerIn: parent
510 anchors.centerIn: parent
638 visible: ApplicationManager.fake ? ApplicationManager.fake : false
511 visible: ApplicationManager.fake ? ApplicationManager.fake : false