@@ -37,7 +37,6 @@ import Unity.Notifications 1.0 as NotificationBackend
3737
3838FocusScope {
3939 id: shell
40− objectName: "shell"
4140
4241 // this is only here to select the width / height of the window if not running fullscreen
4342 property bool tablet: false
@@ -78,11 +77,10 @@ FocusScope {
7877 // FIXME: if application focused before shell starts, shell draws on top of it only.
7978 // We should detect already running applications on shell start and bring them to the front.
8079 applicationManager.unfocusCurrentApplication();
81−
82− applicationManager.setMainStageAppRect(mainStageAppRect);
83− applicationManager.setSideStageAppRect(sideStageAppRect);
8480 }
8581
82+ readonly property bool applicationFocused: !!applicationManager.mainStageFocusedApplication
83+ || !!applicationManager.sideStageFocusedApplication
8684 // Used for autopilot testing.
8785 readonly property string currentFocusedAppId: ApplicationManager.focusedApplicationId
8886
@@ -118,11 +116,6 @@ FocusScope {
118116 }
119117 }
120118
121− Connections {
122− target: applicationManager
123− onFocusRequested: activateApplication(appId)
124− }
125−
126119 GSettings {
127120 id: backgroundSettings
128121 schema.id: "org.gnome.desktop.background"
@@ -147,94 +140,66 @@ FocusScope {
147140 // Whether the underlay is fully covered by opaque UI elements.
148141 property bool fullyCovered: panel.indicators.fullyOpened && shell.width <= panel.indicatorsMenuWidth
149142
150− readonly property bool mainStageApplicationRunning: mainStage.applications && mainStage.applications.count > 0
151− readonly property bool sideStageApplicationRunning: sideStage.applications && sideStage.applications.count > 0
143+ readonly property bool applicationRunning: ((mainStage.applications && mainStage.applications.count > 0)
144+ || (sideStage.applications && sideStage.applications.count > 0))
152145
153146 // Whether the user should see the topmost application surface (if there's one at all).
154− readonly property bool mainStageApplicationShown: mainStageApplicationRunning && !stages.fullyHidden
147+ readonly property bool applicationSurfaceShouldBeSeen: applicationRunning && !stages.fullyHidden
155148 && !mainStage.usingScreenshots // but want sideStage animating over app surface
156149
157150
158151
159152 // NB! Application surfaces are stacked behing the shell one. So they can only be seen by the user
160153 // through the translucent parts of the shell surface.
161− visible: !fullyCovered && !mainStageApplicationShown
162−
163− Item {
164− id: underlayClipper
165− clip: !parent.mainStageApplicationShown && parent.sideStageApplicationRunning && stagesOuterContainer.showProgress > 0
166− width: {
167− if (clip) {
168− var w = parent.width - sideStage.width
169− w += stagesOuterContainer.x + stages.x + (sideStage.x - sideStageRevealer.openedValue)
170− return Math.min(w, parent.width);
171− } else {
172− return parent.width;
173− }
174− }
175− height: parent.height
154+ visible: !fullyCovered && !applicationSurfaceShouldBeSeen
176155
177− Image {
178− anchors.fill: dash
179− source: shell.width > shell.height ? "Dash/graphics/paper_landscape.png" : "Dash/graphics/paper_portrait.png"
180− fillMode: Image.PreserveAspectCrop
181− horizontalAlignment: Image.AlignRight
182− verticalAlignment: Image.AlignTop
183− }
184−
185− Dash {
186− id: dash
187− objectName: "dash"
188−
189− available: !greeter.shown && !lockscreen.shown
190− hides: [stages, launcher, panel.indicators]
191− shown: disappearingAnimationProgress !== 1.0
192− enabled: disappearingAnimationProgress === 0.0 && edgeDemo.dashEnabled
193− // FIXME: unfocus all applications when going back to the dash
194− onEnabledChanged: {
195− if (enabled) {
196− shell.applicationManager.unfocusCurrentApplication()
197− }
198− }
156+ Rectangle {
157+ anchors.fill: parent
158+ color: "black"
159+ opacity: dash.disappearingAnimationProgress
160+ }
199161
200− width: underlay.width
201− height: underlay.height - y
202− y: panel.panelHeight
203−
204− contentScale: 1.0 - 0.2 * disappearingAnimationProgress
205− opacity: 1.0 - disappearingAnimationProgress
206− property real disappearingAnimationProgress: {
207− if (greeter.shown) {
208− return greeter.showProgress;
209− } else {
210− if (underlayClipper.clip)
211− return 0;
212− else
213− return stagesOuterContainer.showProgress;
214− }
215− }
162+ Image {
163+ anchors.fill: dash
164+ source: shell.width > shell.height ? "Dash/graphics/paper_landscape.png" : "Dash/graphics/paper_portrait.png"
165+ fillMode: Image.PreserveAspectCrop
166+ horizontalAlignment: Image.AlignRight
167+ verticalAlignment: Image.AlignTop
168+ }
216169
217− // FIXME: only necessary because stagesOuterContainer.showProgress and
218− // greeterRevealer.animatedProgress are not animated
219− Behavior on disappearingAnimationProgress { SmoothedAnimation { velocity: 5 }}
170+ Dash {
171+ id: dash
172+ objectName: "dash"
173+
174+ available: !greeter.shown && !lockscreen.shown
175+ hides: [stages, launcher, panel.indicators]
176+ shown: disappearingAnimationProgress !== 1.0
177+ enabled: disappearingAnimationProgress === 0.0 && edgeDemo.dashEnabled
178+ // FIXME: unfocus all applications when going back to the dash
179+ onEnabledChanged: {
180+ if (enabled) {
181+ shell.applicationManager.unfocusCurrentApplication()
182+ }
220183 }
221184
222− Rectangle {
223− width: underlay.width
224− height: underlay.height
225− color: "black"
226− opacity: 0.5 * ((sideStage.x - sideStageRevealer.closedValue) / (sideStageRevealer.openedValue - sideStageRevealer.closedValue))
227− visible: sideStageHideButton.enabled
185+ anchors {
186+ fill: parent
187+ topMargin: panel.panelHeight
228188 }
229189
230− AbstractButton {
231− id: sideStageHideButton
232− enabled: mainStage.applications.count == 0 && sideStage.shown
233− anchors.fill: parent
234− onClicked: {
235− sideStage.hide();
190+ contentScale: 1.0 - 0.2 * disappearingAnimationProgress
191+ opacity: 1.0 - disappearingAnimationProgress
192+ property real disappearingAnimationProgress: {
193+ if (greeter.shown) {
194+ return greeter.showProgress;
195+ } else {
196+ return stagesOuterContainer.showProgress;
236197 }
237198 }
199+
200+ // FIXME: only necessary because stagesOuterContainer.showProgress and
201+ // greeterRevealer.animatedProgress are not animated
202+ Behavior on disappearingAnimationProgress { SmoothedAnimation { velocity: 5 }}
238203 }
239204 }
240205
@@ -243,7 +208,7 @@ FocusScope {
243208
244209 width: parent.width
245210 height: parent.height
246− x: mainStage.applications.count > 0 ? launcher.progress : 0
211+ x: launcher.progress
247212 Behavior on x {SmoothedAnimation{velocity: 600}}
248213
249214 property real showProgress:
@@ -255,16 +220,6 @@ FocusScope {
255220
256221 x: width
257222
258− function doLauncherHide() {
259− if (mainStage.applications.count > 0) {
260− hide();
261− } else {
262− if (sideStage.shown) {
263− sideStage.hide();
264− }
265− }
266− }
267−
268223 property bool fullyShown: shown && x == 0 && parent.x == 0
269224 property bool fullyHidden: !shown && x == width
270225 available: !greeter.shown
@@ -349,6 +304,11 @@ FocusScope {
349304 rightEdgeDraggingAreaWidth: shell.edgeSize
350305 normalApplicationY: shell.panelHeight
351306
307+ onShownChanged: {
308+ if (!shown && mainStage.applications.count == 0) {
309+ stages.hide();
310+ }
311+ }
352312 // FIXME: when hiding the side stage, refocus the main stage
353313 // application so that it goes in front of the side stage
354314 // application and hides it
@@ -373,29 +333,12 @@ FocusScope {
373333 width: units.gu(40)
374334 height: stages.height
375335 handleExpanded: sideStageRevealer.pressed
376−
377− Connections {
378− target: sideStage.applications
379− onCountChanged: {
380− if (sideStage.applications.count == 0) {
381− if (sideStage.shown) { // if all SS app closed, hide side stage
382− sideStage.hide();
383− } else {
384− // Sidestage is hidden and there is no main app, make sure the
385− // stages is totally hidden too
386− if (mainStage.applications.count == 0) {
387− stages.hideNow();
388− }
389− }
390− }
391− }
392− }
393336 }
394337
395338 Revealer {
396339 id: sideStageRevealer
397340
398− enabled: sideStage.applications.count > 0
341+ enabled: mainStage.applications.count > 0 && sideStage.applications.count > 0
399342 && sideStage.available
400343 direction: Qt.RightToLeft
401344 openedValue: parent.width - sideStage.width
@@ -413,26 +356,6 @@ FocusScope {
413356 orientation: Qt.Horizontal
414357 }
415358
416− // Defines the rectangle occupied by an application on the main or side stage.
417− // Used only to inform the ApplicationManager. Can be removed when the proper
418− // architecture is in place (unity8 as mir compositor).
419− Item {
420− id: mainStageAppRect
421− x: mainStage.x
422− y: mainStage.y + mainStage.normalApplicationY
423− width: mainStage.width
424− height: mainStage.height
425− visible: false; enabled: false
426− }
427− Item {
428− id: sideStageAppRect
429− x: sideStageRevealer.openedValue
430− y: sideStage.y + sideStage.normalApplicationY
431− width: sideStage.width
432− height: sideStage.height
433− visible: false; enabled: false
434− }
435−
436359 DragHandle {
437360 id: stagesDragHandle
438361
@@ -516,7 +439,7 @@ FocusScope {
516439 hides: [launcher, panel.indicators, hud]
517440 shown: true
518441
519− defaultBackground: shell.defaultBackground
442+ defaultBackground: shell.background
520443
521444 y: panel.panelHeight
522445 width: parent.width
@@ -529,9 +452,7 @@ FocusScope {
529452
530453 function removeApplicationFocus() {
531454 greeter.previousMainApp = applicationManager.mainStageFocusedApplication;
532− if (sideStage.fullyShown) { // if side stage hidden, don't focus it on restore
533− greeter.previousSideApp = applicationManager.sideStageFocusedApplication;
534− }
455+ greeter.previousSideApp = applicationManager.sideStageFocusedApplication;
535456 applicationManager.unfocusCurrentApplication();
536457 }
537458
@@ -600,14 +521,8 @@ FocusScope {
600521 }
601522
602523 InputFilterArea {
603− width: {
604− if (applicationManager.sideStageFocusedApplication && sideStage.shown)
605− return parent.width - sideStage.width;
606− else
607− return parent.width;
608− }
609− height: parent.height
610− blockInput: !applicationManager.mainStageFocusedApplication || greeter.shown || lockscreen.shown || launcher.shown
524+ anchors.fill: parent
525+ blockInput: !applicationFocused || greeter.shown || lockscreen.shown || launcher.shown
611526 || panel.indicators.shown || hud.shown
612527 }
613528
@@ -709,7 +624,7 @@ FocusScope {
709624 theHud: hud
710625 anchors.fill: parent
711626 enabled: hud.available
712− applicationIsOnForeground: (stages.shown && mainStage.applications.count > 0) || (stages.shown && sideStage.shown)
627+ applicationIsOnForeground: applicationFocused
713628 }
714629
715630 InputFilterArea {
@@ -731,7 +646,7 @@ FocusScope {
731646 anchors.bottom: parent.bottom
732647 width: parent.width
733648 dragAreaWidth: shell.edgeSize
734− available: !greeter.locked && edgeDemo.launcherEnabled
649+ available: (!greeter.shown || greeter.narrowMode) && edgeDemo.launcherEnabled
735650
736651 onShowDashHome: {
737652 if (edgeDemo.running)
@@ -741,7 +656,7 @@ FocusScope {
741656 }
742657 onDash: {
743658 if (stages.shown) {
744− stages.doLauncherHide();
659+ stages.hide();
745660 launcher.hide();
746661 }
747662 }
@@ -825,6 +740,21 @@ FocusScope {
825740 value: "unity8"
826741 }
827742
743+ OSKController {
744+ anchors.topMargin: panel.panelHeight
745+ anchors.fill: parent // as needs to know the geometry of the shell
746+ }
747+
748+ //FIXME: This should be handled in the input stack, keyboard shouldnt propagate
749+ MouseArea {
750+ anchors.bottom: parent.bottom
751+ anchors.left: parent.left
752+ anchors.right: parent.right
753+ height: shell.applicationManager ? shell.applicationManager.keyboardHeight : 0
754+
755+ enabled: shell.applicationManager && shell.applicationManager.keyboardVisible
756+ }
757+
828758 Label {
829759 anchors.centerIn: parent
830760 visible: applicationManager.fake
@@ -845,7 +775,7 @@ FocusScope {
845775 launcher: launcher
846776 dash: dash
847777 indicators: panel.indicators
848− underlay: underlayClipper
778+ underlay: underlay
849779 }
850780
851781 Connections {