@@ -37,7 +37,6 @@ import Unity.Notifications 1.0 as NotificationBackend
38FocusScope {
38FocusScope {
42 // this is only here to select the width / height of the window if not running fullscreen
41 // this is only here to select the width / height of the window if not running fullscreen
43 property bool tablet: false
42 property bool tablet: false
@@ -78,11 +77,10 @@ FocusScope {
78 // FIXME: if application focused before shell starts, shell draws on top of it only.
77 // FIXME: if application focused before shell starts, shell draws on top of it only.
79 // We should detect already running applications on shell start and bring them to the front.
78 // We should detect already running applications on shell start and bring them to the front.
80 applicationManager.unfocusCurrentApplication();
79 applicationManager.unfocusCurrentApplication();
82− applicationManager.setMainStageAppRect(mainStageAppRect);
83− applicationManager.setSideStageAppRect(sideStageAppRect);
82+ readonly property bool applicationFocused: !!applicationManager.mainStageFocusedApplication
83+ || !!applicationManager.sideStageFocusedApplication
86 // Used for autopilot testing.
84 // Used for autopilot testing.
87 readonly property string currentFocusedAppId: ApplicationManager.focusedApplicationId
85 readonly property string currentFocusedAppId: ApplicationManager.focusedApplicationId
@@ -118,11 +116,6 @@ FocusScope {
122− target: applicationManager
123− onFocusRequested: activateApplication(appId)
126 GSettings {
119 GSettings {
127 id: backgroundSettings
120 id: backgroundSettings
128 schema.id: "org.gnome.desktop.background"
121 schema.id: "org.gnome.desktop.background"
@@ -147,94 +140,66 @@ FocusScope {
147 // Whether the underlay is fully covered by opaque UI elements.
140 // Whether the underlay is fully covered by opaque UI elements.
148 property bool fullyCovered: panel.indicators.fullyOpened && shell.width <= panel.indicatorsMenuWidth
141 property bool fullyCovered: panel.indicators.fullyOpened && shell.width <= panel.indicatorsMenuWidth
150− readonly property bool mainStageApplicationRunning: mainStage.applications && mainStage.applications.count > 0
143+ readonly property bool applicationRunning: ((mainStage.applications && mainStage.applications.count > 0)
151− readonly property bool sideStageApplicationRunning: sideStage.applications && sideStage.applications.count > 0
144+ || (sideStage.applications && sideStage.applications.count > 0))
153 // Whether the user should see the topmost application surface (if there's one at all).
146 // 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
155 && !mainStage.usingScreenshots // but want sideStage animating over app surface
148 && !mainStage.usingScreenshots // but want sideStage animating over app surface
159 // NB! Application surfaces are stacked behing the shell one. So they can only be seen by the user
152 // NB! Application surfaces are stacked behing the shell one. So they can only be seen by the user
160 // through the translucent parts of the shell surface.
153 // through the translucent parts of the shell surface.
161− visible: !fullyCovered && !mainStageApplicationShown
154+ visible: !fullyCovered && !applicationSurfaceShouldBeSeen
165− clip: !parent.mainStageApplicationShown && parent.sideStageApplicationRunning && stagesOuterContainer.showProgress > 0
168− var w = parent.width - sideStage.width
169− w += stagesOuterContainer.x + stages.x + (sideStage.x - sideStageRevealer.openedValue)
170− return Math.min(w, parent.width);
172− return parent.width;
175− height: parent.height
177− Image {
156+ Rectangle {
178− anchors.fill: dash
157+ anchors.fill: parent
179− source: shell.width > shell.height ? "Dash/graphics/paper_landscape.png" : "Dash/graphics/paper_portrait.png"
158+ color: "black"
180− fillMode: Image.PreserveAspectCrop
181− horizontalAlignment: Image.AlignRight
182− verticalAlignment: Image.AlignTop
189− available: !greeter.shown && !lockscreen.shown
190− hides: [stages, launcher, panel.indicators]
191− shown: disappearingAnimationProgress !== 1.0
159+ opacity: dash.disappearingAnimationProgress
192− enabled: disappearingAnimationProgress === 0.0 && edgeDemo.dashEnabled
193− // FIXME: unfocus all applications when going back to the dash
196− shell.applicationManager.unfocusCurrentApplication()
200− width: underlay.width
162+ Image {
201− height: underlay.height - y
163+ anchors.fill: dash
202− y: panel.panelHeight
164+ source: shell.width > shell.height ? "Dash/graphics/paper_landscape.png" : "Dash/graphics/paper_portrait.png"
203−
165+ fillMode: Image.PreserveAspectCrop
204− contentScale: 1.0 - 0.2 * disappearingAnimationProgress
166+ horizontalAlignment: Image.AlignRight
205− opacity: 1.0 - disappearingAnimationProgress
167+ verticalAlignment: Image.AlignTop
206− property real disappearingAnimationProgress: {
207− if (greeter.shown) {
208− return greeter.showProgress;
210− if (underlayClipper.clip)
213− return stagesOuterContainer.showProgress;
217− // FIXME: only necessary because stagesOuterContainer.showProgress and
170+ Dash {
218− // greeterRevealer.animatedProgress are not animated
171+ id: dash
219− Behavior on disappearingAnimationProgress { SmoothedAnimation { velocity: 5 }}
172+ objectName: "dash"
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
181+ shell.applicationManager.unfocusCurrentApplication()
222− Rectangle {
185+ anchors {
223− width: underlay.width
186+ fill: parent
224− height: underlay.height
187+ topMargin: panel.panelHeight
226− opacity: 0.5 * ((sideStage.x - sideStageRevealer.closedValue) / (sideStageRevealer.openedValue - sideStageRevealer.closedValue))
227− visible: sideStageHideButton.enabled
230− AbstractButton {
190+ contentScale: 1.0 - 0.2 * disappearingAnimationProgress
231− id: sideStageHideButton
191+ opacity: 1.0 - disappearingAnimationProgress
232− enabled: mainStage.applications.count == 0 && sideStage.shown
192+ property real disappearingAnimationProgress: {
233− anchors.fill: parent
193+ if (greeter.shown) {
234− onClicked: {
194+ return greeter.showProgress;
235− sideStage.hide();
195+ } else {
196+ return stagesOuterContainer.showProgress;
200+ // FIXME: only necessary because stagesOuterContainer.showProgress and
201+ // greeterRevealer.animatedProgress are not animated
202+ Behavior on disappearingAnimationProgress { SmoothedAnimation { velocity: 5 }}
@@ -243,7 +208,7 @@ FocusScope {
244 width: parent.width
209 width: parent.width
245 height: parent.height
210 height: parent.height
246− x: mainStage.applications.count > 0 ? launcher.progress : 0
211+ x: launcher.progress
247 Behavior on x {SmoothedAnimation{velocity: 600}}
212 Behavior on x {SmoothedAnimation{velocity: 600}}
249 property real showProgress:
214 property real showProgress:
@@ -255,16 +220,6 @@ FocusScope {
258− function doLauncherHide() {
259− if (mainStage.applications.count > 0) {
262− if (sideStage.shown) {
268 property bool fullyShown: shown && x == 0 && parent.x == 0
223 property bool fullyShown: shown && x == 0 && parent.x == 0
269 property bool fullyHidden: !shown && x == width
224 property bool fullyHidden: !shown && x == width
270 available: !greeter.shown
225 available: !greeter.shown
@@ -349,6 +304,11 @@ FocusScope {
349 rightEdgeDraggingAreaWidth: shell.edgeSize
304 rightEdgeDraggingAreaWidth: shell.edgeSize
350 normalApplicationY: shell.panelHeight
305 normalApplicationY: shell.panelHeight
308+ if (!shown && mainStage.applications.count == 0) {
352 // FIXME: when hiding the side stage, refocus the main stage
312 // FIXME: when hiding the side stage, refocus the main stage
353 // application so that it goes in front of the side stage
313 // application so that it goes in front of the side stage
354 // application and hides it
314 // application and hides it
@@ -373,29 +333,12 @@ FocusScope {
373 width: units.gu(40)
333 width: units.gu(40)
374 height: stages.height
334 height: stages.height
375 handleExpanded: sideStageRevealer.pressed
335 handleExpanded: sideStageRevealer.pressed
378− target: sideStage.applications
380− if (sideStage.applications.count == 0) {
381− if (sideStage.shown) { // if all SS app closed, hide side stage
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) {
395 Revealer {
338 Revealer {
396 id: sideStageRevealer
339 id: sideStageRevealer
398− enabled: sideStage.applications.count > 0
341+ enabled: mainStage.applications.count > 0 && sideStage.applications.count > 0
399 && sideStage.available
342 && sideStage.available
400 direction: Qt.RightToLeft
343 direction: Qt.RightToLeft
401 openedValue: parent.width - sideStage.width
344 openedValue: parent.width - sideStage.width
@@ -413,26 +356,6 @@ FocusScope {
413 orientation: Qt.Horizontal
356 orientation: Qt.Horizontal
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).
420− id: mainStageAppRect
422− y: mainStage.y + mainStage.normalApplicationY
423− width: mainStage.width
424− height: mainStage.height
425− visible: false; enabled: false
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
436 DragHandle {
359 DragHandle {
437 id: stagesDragHandle
360 id: stagesDragHandle
@@ -516,7 +439,7 @@ FocusScope {
516 hides: [launcher, panel.indicators, hud]
439 hides: [launcher, panel.indicators, hud]
517 shown: true
440 shown: true
519− defaultBackground: shell.defaultBackground
442+ defaultBackground: shell.background
521 y: panel.panelHeight
444 y: panel.panelHeight
522 width: parent.width
445 width: parent.width
@@ -529,9 +452,7 @@ FocusScope {
530 function removeApplicationFocus() {
453 function removeApplicationFocus() {
531 greeter.previousMainApp = applicationManager.mainStageFocusedApplication;
454 greeter.previousMainApp = applicationManager.mainStageFocusedApplication;
532− if (sideStage.fullyShown) { // if side stage hidden, don't focus it on restore
533− greeter.previousSideApp = applicationManager.sideStageFocusedApplication;
455+ greeter.previousSideApp = applicationManager.sideStageFocusedApplication;
535 applicationManager.unfocusCurrentApplication();
456 applicationManager.unfocusCurrentApplication();
@@ -600,14 +521,8 @@ FocusScope {
602 InputFilterArea {
523 InputFilterArea {
603− width: {
524+ anchors.fill: parent
604− if (applicationManager.sideStageFocusedApplication && sideStage.shown)
605− return parent.width - sideStage.width;
607− return parent.width;
609− height: parent.height
610− blockInput: !applicationManager.mainStageFocusedApplication || greeter.shown || lockscreen.shown || launcher.shown
525+ blockInput: !applicationFocused || greeter.shown || lockscreen.shown || launcher.shown
611 || panel.indicators.shown || hud.shown
526 || panel.indicators.shown || hud.shown
@@ -709,7 +624,7 @@ FocusScope {
709 theHud: hud
624 theHud: hud
710 anchors.fill: parent
625 anchors.fill: parent
711 enabled: hud.available
626 enabled: hud.available
712− applicationIsOnForeground: (stages.shown && mainStage.applications.count > 0) || (stages.shown && sideStage.shown)
627+ applicationIsOnForeground: applicationFocused
715 InputFilterArea {
630 InputFilterArea {
@@ -731,7 +646,7 @@ FocusScope {
731 anchors.bottom: parent.bottom
646 anchors.bottom: parent.bottom
732 width: parent.width
647 width: parent.width
733 dragAreaWidth: shell.edgeSize
648 dragAreaWidth: shell.edgeSize
734− available: !greeter.locked && edgeDemo.launcherEnabled
649+ available: (!greeter.shown || greeter.narrowMode) && edgeDemo.launcherEnabled
736 onShowDashHome: {
651 onShowDashHome: {
737 if (edgeDemo.running)
652 if (edgeDemo.running)
@@ -741,7 +656,7 @@ FocusScope {
742 onDash: {
657 onDash: {
743 if (stages.shown) {
658 if (stages.shown) {
744− stages.doLauncherHide();
659+ stages.hide();
745 launcher.hide();
660 launcher.hide();
@@ -825,6 +740,21 @@ FocusScope {
825 value: "unity8"
740 value: "unity8"
744+ anchors.topMargin: panel.panelHeight
745+ anchors.fill: parent // as needs to know the geometry of the shell
748+ //FIXME: This should be handled in the input stack, keyboard shouldnt propagate
750+ anchors.bottom: parent.bottom
751+ anchors.left: parent.left
752+ anchors.right: parent.right
753+ height: shell.applicationManager ? shell.applicationManager.keyboardHeight : 0
755+ enabled: shell.applicationManager && shell.applicationManager.keyboardVisible
829 anchors.centerIn: parent
759 anchors.centerIn: parent
830 visible: applicationManager.fake
760 visible: applicationManager.fake
@@ -845,7 +775,7 @@ FocusScope {
845 launcher: launcher
775 launcher: launcher
846 dash: dash
776 dash: dash
847 indicators: panel.indicators
777 indicators: panel.indicators
848− underlay: underlayClipper
778+ underlay: underlay
851 Connections {
781 Connections {