@@ -49,20 +49,22 @@ FocusScope {
49 readonly property real panelHeight: panel.panelHeight
49 readonly property real panelHeight: panel.panelHeight
51 property bool dashShown: dash.shown
51 property bool dashShown: dash.shown
52− property bool stageScreenshotsReady: {
52+
53− if (sideStage.shown) {
53+ function activateApplication(appId) {
54− if (mainStage.applications.count > 0) {
54+ if (ApplicationManager.findApplication(appId)) {
55− return mainStage.usingScreenshots && sideStage.usingScreenshots;
55+ print("Shell.qml: activating app", appId);
56− } else {
56+ ApplicationManager.activateApplication(appId);
57− return sideStage.usingScreenshots;
60− return mainStage.usingScreenshots;
58+ print("starting app", appId);
61+// var execFlags = sideStageEnabled ? ApplicationManager.NoFlag : ApplicationManager.ForceMainStage;
62+ var execFlags = ApplicationManager.ForceMainStage;
64+ ApplicationManager.startApplication(appId, execFlags);
64− property var applicationManager: ApplicationManagerWrapper {}
67 target: LauncherModel
69 target: LauncherModel
68 property: "applicationManager"
70 property: "applicationManager"
@@ -71,49 +73,6 @@ FocusScope {
72 Component.onCompleted: {
74 Component.onCompleted: {
73 Theme.name = "Ubuntu.Components.Themes.SuruGradient"
75 Theme.name = "Ubuntu.Components.Themes.SuruGradient"
75− applicationManager.sideStageEnabled = Qt.binding(function() { return sideStage.enabled })
77− // FIXME: if application focused before shell starts, shell draws on top of it only.
78− // We should detect already running applications on shell start and bring them to the front.
79− applicationManager.unfocusCurrentApplication();
82− readonly property bool applicationFocused: !!applicationManager.mainStageFocusedApplication
83− || !!applicationManager.sideStageFocusedApplication
84− // Used for autopilot testing.
85− readonly property string currentFocusedAppId: ApplicationManager.focusedApplicationId
87− readonly property bool fullscreenMode: {
88− if (greeter.shown || lockscreen.shown) {
90− } else if (mainStage.usingScreenshots) { // Window Manager animating so want to re-evaluate fullscreen mode
91− return mainStage.switchingFromFullscreenToFullscreen;
92− } else if (applicationManager.mainStageFocusedApplication) {
93− return applicationManager.mainStageFocusedApplication.fullscreen;
99− function activateApplication(appId, argument) {
100− if (applicationManager) {
101− // For newly started applications, as it takes them time to draw their first frame
102− // we add a delay before we hide the animation screenshots to compensate.
103− var addDelay = !applicationManager.getApplicationFromDesktopFile(appId);
106− application = applicationManager.activateApplication(appId, argument);
107− if (application == null) {
110− if (application.stage == ApplicationInfo.MainStage || !sideStage.enabled) {
111− mainStage.activateApplication(appId, addDelay);
113− sideStage.activateApplication(appId, addDelay);
119 GSettings {
78 GSettings {
@@ -161,19 +120,18 @@ FocusScope {
161 // Whether the underlay is fully covered by opaque UI elements.
120 // Whether the underlay is fully covered by opaque UI elements.
162 property bool fullyCovered: panel.indicators.fullyOpened && shell.width <= panel.indicatorsMenuWidth
121 property bool fullyCovered: panel.indicators.fullyOpened && shell.width <= panel.indicatorsMenuWidth
164− readonly property bool applicationRunning: ((mainStage.applications && mainStage.applications.count > 0)
123+ readonly property bool applicationRunning: ApplicationManager.focusedApplicationId.length > 0
165− || (sideStage.applications && sideStage.applications.count > 0))
167 // Whether the user should see the topmost application surface (if there's one at all).
125 // Whether the user should see the topmost application surface (if there's one at all).
168− readonly property bool applicationSurfaceShouldBeSeen: applicationRunning && !stages.fullyHidden
126+ readonly property bool applicationSurfaceShouldBeSeen: applicationRunning && !stages.painting
169− && !mainStage.usingScreenshots // but want sideStage animating over app surface
173 // NB! Application surfaces are stacked behing the shell one. So they can only be seen by the user
128 // NB! Application surfaces are stacked behing the shell one. So they can only be seen by the user
174 // through the translucent parts of the shell surface.
129 // through the translucent parts of the shell surface.
175 visible: !fullyCovered && !applicationSurfaceShouldBeSeen
130 visible: !fullyCovered && !applicationSurfaceShouldBeSeen
132+ onVisibleChanged: print("hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh", visible, fullyCovered, applicationSurfaceShouldBeSeen,
133+ applicationRunning, stages.fullyHidden, stages.usingScreenshots)
177 CrossFadeImage {
135 CrossFadeImage {
178 id: backgroundImage
136 id: backgroundImage
179 objectName: "backgroundImage"
137 objectName: "backgroundImage"
@@ -197,12 +155,6 @@ FocusScope {
197 hides: [stages, launcher, panel.indicators]
155 hides: [stages, launcher, panel.indicators]
198 shown: disappearingAnimationProgress !== 1.0
156 shown: disappearingAnimationProgress !== 1.0
199 enabled: disappearingAnimationProgress === 0.0 && edgeDemo.dashEnabled
157 enabled: disappearingAnimationProgress === 0.0 && edgeDemo.dashEnabled
200− // FIXME: unfocus all applications when going back to the dash
203− shell.applicationManager.unfocusCurrentApplication()
207 anchors {
159 anchors {
208 fill: parent
160 fill: parent
@@ -233,8 +185,7 @@ FocusScope {
233 x: launcher.progress
185 x: launcher.progress
234 Behavior on x {SmoothedAnimation{velocity: 600}}
186 Behavior on x {SmoothedAnimation{velocity: 600}}
236− property real showProgress:
237− MathUtils.clamp(1 - (x + stages.x) / shell.width, 0, 1)
188+ property real showProgress: MathUtils.clamp(1 - (x + stages.x) / shell.width, 0, 1)
239 Showable {
190 Showable {
240 id: stages
191 id: stages
@@ -244,6 +195,9 @@ FocusScope {
245 property bool fullyShown: shown && x == 0 && parent.x == 0
196 property bool fullyShown: shown && x == 0 && parent.x == 0
246 property bool fullyHidden: !shown && x == width
197 property bool fullyHidden: !shown && x == width
199+ property bool painting: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.painting : false
247 available: !greeter.shown
201 available: !greeter.shown
248 hides: [panel.indicators]
202 hides: [panel.indicators]
249 shown: false
203 shown: false
@@ -254,145 +208,50 @@ FocusScope {
254 width: parent.width
208 width: parent.width
255 height: parent.height
209 height: parent.height
257− // close the stages when no focused application remains
211+ onShownChanged: {
258− Connections {
212+ print("stages shown", shown)
259− target: shell.applicationManager
213+ if (!shown) {
260− onMainStageFocusedApplicationChanged: stages.closeIfNoApplications()
214+ ApplicationManager.unfocusCurrentApplication();
261− onSideStageFocusedApplicationChanged: stages.closeIfNoApplications()
215+ }
262− ignoreUnknownSignals: true
265− function closeIfNoApplications() {
218+ onFullyShownChanged: {
266− if (!shell.applicationManager.mainStageFocusedApplication
219+ print("kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk", fullyShown)
267− && !shell.applicationManager.sideStageFocusedApplication
268− && shell.applicationManager.mainStageApplications.count == 0
269− && shell.applicationManager.sideStageApplications.count == 0) {
274− // show the stages when an application gets the focus
275 Connections {
222 Connections {
276− target: shell.applicationManager
223+ target: ApplicationManager
277− onMainStageFocusedApplicationChanged: {
224+ onFocusedApplicationIdChanged: {
278− if (shell.applicationManager.mainStageFocusedApplication) {
225+ if (ApplicationManager.focusedApplicationId.length > 0) {
279− mainStage.show();
226+ print("should show stages")
280 stages.show();
227 stages.show();
283− onSideStageFocusedApplicationChanged: {
284− if (shell.applicationManager.sideStageFocusedApplication) {
289− ignoreUnknownSignals: true
292− Stage {
231+ onApplicationAdded: {
295− anchors.fill: parent
296− fullyShown: stages.fullyShown
297− fullyHidden: stages.fullyHidden
298− shouldUseScreenshots: !fullyShown
299− rightEdgeEnabled: !sideStage.enabled
301− applicationManager: shell.applicationManager
302− rightEdgeDraggingAreaWidth: shell.edgeSize
303− normalApplicationY: shell.panelHeight
307 stages.show();
232 stages.show();
312− // FIXME: workaround the fact that focusing a main stage application
313− // raises its surface on top of all other surfaces including the ones
314− // that belong to side stage applications.
315− onFocusedApplicationChanged: {
316− if (focusedApplication && sideStage.focusedApplication && sideStage.fullyShown) {
317− shell.applicationManager.focusApplication(sideStage.focusedApplication);
322− SideStage {
236+ Loader {
323− id: sideStage
237+ id: applicationsDisplayLoader
238+ anchors.fill: parent
240+// source: "Stages/StageWithSideStage.qml"
241+ source: "Stages/PhoneStage.qml"
325− applicationManager: shell.applicationManager
243+// Rectangle { anchors.fill: parent; color: "blue"; opacity: .5 }
326− rightEdgeDraggingAreaWidth: shell.edgeSize
327− normalApplicationY: shell.panelHeight
329− onShownChanged: {
245+ Binding {
330− if (!shown && mainStage.applications.count == 0) {
246+ target: applicationsDisplayLoader.item
331− stages.hide();
247+ property: "moving"
332− }
248+ value: !stages.fullyShown
334− // FIXME: when hiding the side stage, refocus the main stage
250+ Binding {
335− // application so that it goes in front of the side stage
251+ target: applicationsDisplayLoader.item
336− // application and hides it
252+ property: "shown"
337− onFullyShownChanged: {
253+ value: stages.shown
338− if (!fullyShown && stages.fullyShown && sideStage.focusedApplication != null) {
339− shell.applicationManager.focusApplication(mainStage.focusedApplication);
343− enabled: shell.width >= units.gu(60)
345− fullyShown: stages.fullyShown && shown
346− && sideStage[sideStageRevealer.boundProperty] == sideStageRevealer.openedValue
347− shouldUseScreenshots: !fullyShown || mainStage.usingScreenshots || sideStageRevealer.pressed
349− available: !greeter.shown && !lockscreen.shown && enabled
350− hides: [launcher, panel.indicators]
352− showAnimation: StandardAnimation { property: "x"; duration: 350; to: sideStageRevealer.openedValue; easing.type: Easing.OutQuint }
353− hideAnimation: StandardAnimation { property: "x"; duration: 350; to: sideStageRevealer.closedValue; easing.type: Easing.OutQuint }
356− height: stages.height
357− handleExpanded: sideStageRevealer.pressed
361− id: sideStageRevealer
363− enabled: mainStage.applications.count > 0 && sideStage.applications.count > 0
364− && sideStage.available
365− direction: Qt.RightToLeft
366− openedValue: parent.width - sideStage.width
367− hintDisplacement: units.gu(3)
368− /* The size of the sidestage handle needs to be bigger than the
369− typical size used for edge detection otherwise it is really
372− handleSize: sideStage.shown ? units.gu(4) : shell.edgeSize
373− closedValue: parent.width + sideStage.handleSizeCollapsed
375− x: parent.width - width
376− width: sideStage.width + handleSize * 0.7
377− height: sideStage.height
378− orientation: Qt.Horizontal
382− id: stagesDragHandle
384− anchors.top: parent.top
385− anchors.bottom: parent.bottom
386− anchors.right: parent.left
388− width: shell.edgeSize
389− direction: Direction.Leftwards
390− enabled: greeter.showProgress == 0 && edgeDemo.dashEnabled
391− property bool haveApps: mainStage.applications.count > 0 || sideStage.applications.count > 0
393− maxTotalDragDistance: haveApps ? parent.width : parent.width * 0.7
394− // Make autocompletion impossible when !haveApps
395− edgeDragEvaluator.minDragDistance: haveApps ? maxTotalDragDistance * 0.1 : Number.MAX_VALUE
@@ -472,23 +331,6 @@ FocusScope {
472 property var previousMainApp: null
331 property var previousMainApp: null
473 property var previousSideApp: null
332 property var previousSideApp: null
475− function removeApplicationFocus() {
476− greeter.previousMainApp = applicationManager.mainStageFocusedApplication;
477− greeter.previousSideApp = applicationManager.sideStageFocusedApplication;
478− applicationManager.unfocusCurrentApplication();
481− function restoreApplicationFocus() {
482− if (greeter.previousMainApp) {
483− applicationManager.focusApplication(greeter.previousMainApp);
484− greeter.previousMainApp = null;
486− if (greeter.previousSideApp) {
487− applicationManager.focusApplication(greeter.previousSideApp);
488− greeter.previousSideApp = null;
492 onShownChanged: {
334 onShownChanged: {
493 if (shown) {
335 if (shown) {
494 lockscreen.reset();
336 lockscreen.reset();
@@ -499,9 +341,6 @@ FocusScope {
499 greeter.selected(0);
341 greeter.selected(0);
501 greeter.forceActiveFocus();
343 greeter.forceActiveFocus();
502− removeApplicationFocus();
504− restoreApplicationFocus();
@@ -518,34 +357,11 @@ FocusScope {
518 launcher.tease();
357 launcher.tease();
523− target: applicationManager
524− ignoreUnknownSignals: true
525− // If any app is focused when greeter is open, it's due to a user action
526− // like a snap decision (say, an incoming call).
527− // TODO: these should be protected to only unlock for certain applications / certain usecases
528− // potentially only in connection with a notification.
529− onMainStageFocusedApplicationChanged: {
530− if (greeter.shown && applicationManager.mainStageFocusedApplication) {
531− greeter.previousMainApp = null // make way for new focused app
532− greeter.previousSideApp = null
536− onSideStageFocusedApplicationChanged: {
537− if (greeter.shown && applicationManager.sideStageFocusedApplication) {
538− greeter.previousMainApp = null // make way for new focused app
539− greeter.previousSideApp = null
546 InputFilterArea {
362 InputFilterArea {
547 anchors.fill: parent
363 anchors.fill: parent
548− blockInput: !applicationFocused || greeter.shown || lockscreen.shown || launcher.shown
364+ blockInput: ApplicationManager.focusedApplicationId.length === 0 || greeter.shown || lockscreen.shown || launcher.shown
549 || panel.indicators.shown || hud.shown
365 || panel.indicators.shown || hud.shown
@@ -590,7 +406,9 @@ FocusScope {
590 available: edgeDemo.panelEnabled
406 available: edgeDemo.panelEnabled
591 contentEnabled: edgeDemo.panelContentEnabled
407 contentEnabled: edgeDemo.panelContentEnabled
593− fullscreenMode: shell.fullscreenMode
409+ property string focusedAppId: ApplicationManager.focusedApplicationId
410+ property var focusedApplication: ApplicationManager.findApplication(focusedAppId)
411+ fullscreenMode: focusedApplication && focusedApplication.fullscreen
594 searchVisible: !greeter.shown && !lockscreen.shown && dash.shown
412 searchVisible: !greeter.shown && !lockscreen.shown && dash.shown
596 InputFilterArea {
414 InputFilterArea {
@@ -616,9 +434,8 @@ FocusScope {
616 hideAnimation: StandardAnimation { property: "y"; duration: hud.showableAnimationDuration; to: hudRevealer.closedValue; easing.type: Easing.Linear }
434 hideAnimation: StandardAnimation { property: "y"; duration: hud.showableAnimationDuration; to: hudRevealer.closedValue; easing.type: Easing.Linear }
618 Connections {
436 Connections {
619− target: shell.applicationManager
437+ target: ApplicationManager
620− onMainStageFocusedApplicationChanged: hud.hide()
438+ onFocusedApplicationIdChanged: hud.hide()
621− onSideStageFocusedApplicationChanged: hud.hide()
@@ -643,7 +460,7 @@ FocusScope {
643 theHud: hud
460 theHud: hud
644 anchors.fill: parent
461 anchors.fill: parent
645 enabled: hud.available
462 enabled: hud.available
646− applicationIsOnForeground: applicationFocused
463+ applicationIsOnForeground: ApplicationManager.focusedApplicationId
649 InputFilterArea {
466 InputFilterArea {
@@ -667,7 +484,12 @@ FocusScope {
667 dragAreaWidth: shell.edgeSize
484 dragAreaWidth: shell.edgeSize
668 available: (!greeter.shown || greeter.narrowMode) && edgeDemo.launcherEnabled
485 available: (!greeter.shown || greeter.narrowMode) && edgeDemo.launcherEnabled
670− onDashItemSelected: showHome()
487+ onDashItemSelected: {
488+ if (edgeDemo.running)
671 onDash: {
493 onDash: {
672 if (stages.shown) {
494 if (stages.shown) {
673 stages.hide();
495 stages.hide();
@@ -676,6 +498,9 @@ FocusScope {
677 onDashSwipeChanged: if (dashSwipe && stages.shown) dash.setCurrentScope("applications.scope", false, true)
499 onDashSwipeChanged: if (dashSwipe && stages.shown) dash.setCurrentScope("applications.scope", false, true)
678 onLauncherApplicationSelected:{
500 onLauncherApplicationSelected:{
501+ if (edgeDemo.running)
679 greeter.hide()
504 greeter.hide()
680 shell.activateApplication(appId)
505 shell.activateApplication(appId)
@@ -761,14 +586,14 @@ FocusScope {
761 anchors.bottom: parent.bottom
586 anchors.bottom: parent.bottom
762 anchors.left: parent.left
587 anchors.left: parent.left
763 anchors.right: parent.right
588 anchors.right: parent.right
764− height: shell.applicationManager ? shell.applicationManager.keyboardHeight : 0
589+ height: ApplicationManager.keyboardVisible ? ApplicationManager.keyboardHeight : 0
766− enabled: shell.applicationManager && shell.applicationManager.keyboardVisible
591+ enabled: ApplicationManager.keyboardVisible
770 anchors.centerIn: parent
595 anchors.centerIn: parent
771− visible: applicationManager.fake
596+ visible: ApplicationManager.fake ? ApplicationManager.fake : false
772 text: "EARLY ALPHA\nNOT READY FOR USE"
597 text: "EARLY ALPHA\nNOT READY FOR USE"
773 color: "lightgrey"
598 color: "lightgrey"
774 opacity: 0.2
599 opacity: 0.2