@@ -224,9 +224,12 @@ AbstractStage {
224 PanelState.dropShadow = false;
224 PanelState.dropShadow = false;
228− id: stageContainer
228+ FocusScope {
230+ objectName: "appContainer"
229 anchors.fill: parent
231 anchors.fill: parent
232+ focus: spread.state !== "altTab"
231 CrossFadeImage {
234 CrossFadeImage {
232 id: wallpaper
235 id: wallpaper
@@ -236,245 +239,238 @@ AbstractStage {
236 fillMode: Image.PreserveAspectCrop
239 fillMode: Image.PreserveAspectCrop
241− objectName: "appContainer"
242− anchors.fill: parent
243− anchors.leftMargin: root.leftMargin
244− focus: spread.state !== "altTab"
246− Repeater {
242+ Repeater {
247− id: appRepeater
243+ id: appRepeater
248− model: ApplicationManager
244+ model: ApplicationManager
249− objectName: "appRepeater"
245+ objectName: "appRepeater"
251− delegate: FocusScope {
247+ delegate: FocusScope {
252− id: appDelegate
248+ id: appDelegate
253− objectName: "appDelegate_" + appId
249+ objectName: "appDelegate_" + appId
254− // z might be overriden in some cases by effects, but we need z ordering
250+ // z might be overriden in some cases by effects, but we need z ordering
255− // to calculate occlusion detection
251+ // to calculate occlusion detection
256− property int normalZ: ApplicationManager.count - index
252+ property int normalZ: ApplicationManager.count - index
257− z: normalZ
253+ z: normalZ
258− y: PanelState.panelHeight
254+ y: PanelState.panelHeight
259− focus: appId === priv.focusedAppId
255+ focus: appId === priv.focusedAppId
260− width: decoratedWindow.width
256+ width: decoratedWindow.width
261− height: decoratedWindow.height
257+ height: decoratedWindow.height
262− property alias requestedWidth: decoratedWindow.requestedWidth
258+ property alias requestedWidth: decoratedWindow.requestedWidth
263− property alias requestedHeight: decoratedWindow.requestedHeight
259+ property alias requestedHeight: decoratedWindow.requestedHeight
264− property alias minimumWidth: decoratedWindow.minimumWidth
260+ property alias minimumWidth: decoratedWindow.minimumWidth
265− property alias minimumHeight: decoratedWindow.minimumHeight
261+ property alias minimumHeight: decoratedWindow.minimumHeight
266− property alias maximumWidth: decoratedWindow.maximumWidth
262+ property alias maximumWidth: decoratedWindow.maximumWidth
267− property alias maximumHeight: decoratedWindow.maximumHeight
263+ property alias maximumHeight: decoratedWindow.maximumHeight
268− property alias widthIncrement: decoratedWindow.widthIncrement
264+ property alias widthIncrement: decoratedWindow.widthIncrement
269− property alias heightIncrement: decoratedWindow.heightIncrement
265+ property alias heightIncrement: decoratedWindow.heightIncrement
272− QtObject {
267+ QtObject {
273− id: appDelegatePrivate
268+ id: appDelegatePrivate
274− property bool maximized: false
269+ property bool maximized: false
275− property bool maximizedLeft: false
270+ property bool maximizedLeft: false
276− property bool maximizedRight: false
271+ property bool maximizedRight: false
277− property bool minimized: false
272+ property bool minimized: false
279− readonly property alias maximized: appDelegatePrivate.maximized
274+ readonly property alias maximized: appDelegatePrivate.maximized
280− readonly property alias maximizedLeft: appDelegatePrivate.maximizedLeft
275+ readonly property alias maximizedLeft: appDelegatePrivate.maximizedLeft
281− readonly property alias maximizedRight: appDelegatePrivate.maximizedRight
276+ readonly property alias maximizedRight: appDelegatePrivate.maximizedRight
282− readonly property alias minimized: appDelegatePrivate.minimized
277+ readonly property alias minimized: appDelegatePrivate.minimized
284− readonly property string appId: model.appId
279+ readonly property string appId: model.appId
285− property bool animationsEnabled: true
280+ property bool animationsEnabled: true
286− property alias title: decoratedWindow.title
281+ property alias title: decoratedWindow.title
287− readonly property string appName: model.name
282+ readonly property string appName: model.name
288− property bool visuallyMaximized: false
283+ property bool visuallyMaximized: false
289− property bool visuallyMinimized: false
284+ property bool visuallyMinimized: false
291− onFocusChanged: {
286+ onFocusChanged: {
292− if (focus && ApplicationManager.focusedApplicationId !== appId) {
287+ if (focus && ApplicationManager.focusedApplicationId !== appId) {
293− ApplicationManager.focusApplication(appId);
288+ ApplicationManager.focusApplication(appId);
297− onVisuallyMaximizedChanged: priv.updateForegroundMaximizedApp()
292+ onVisuallyMaximizedChanged: priv.updateForegroundMaximizedApp()
299− visible: !visuallyMinimized &&
294+ visible: !visuallyMinimized &&
300− !greeter.fullyShown &&
295+ !greeter.fullyShown &&
301− (priv.foregroundMaximizedAppZ === -1 || priv.foregroundMaximizedAppZ <= z) ||
296+ (priv.foregroundMaximizedAppZ === -1 || priv.foregroundMaximizedAppZ <= z) ||
297+ decoratedWindow.fullscreen ||
302− (spread.state == "altTab" && index === spread.highlightedIndex)
298+ (spread.state == "altTab" && index === spread.highlightedIndex)
304− Binding {
300+ Binding {
305− target: ApplicationManager.get(index)
301+ target: ApplicationManager.get(index)
306− property: "requestedState"
302+ property: "requestedState"
307− // TODO: figure out some lifecycle policy, like suspending minimized apps
303+ // TODO: figure out some lifecycle policy, like suspending minimized apps
308− // if running on a tablet or something.
304+ // if running on a tablet or something.
309− // TODO: If the device has a dozen suspended apps because it was running
305+ // TODO: If the device has a dozen suspended apps because it was running
310− // in staged mode, when it switches to Windowed mode it will suddenly
306+ // in staged mode, when it switches to Windowed mode it will suddenly
311− // resume all those apps at once. We might want to avoid that.
307+ // resume all those apps at once. We might want to avoid that.
312− value: ApplicationInfoInterface.RequestedRunning // Always running for now
308+ value: ApplicationInfoInterface.RequestedRunning // Always running for now
315− function maximize(animated) {
311+ function maximize(animated) {
316− animationsEnabled = (animated === undefined) || animated;
312+ animationsEnabled = (animated === undefined) || animated;
317− appDelegatePrivate.minimized = false;
313+ appDelegatePrivate.minimized = false;
318− appDelegatePrivate.maximized = true;
314+ appDelegatePrivate.maximized = true;
319− appDelegatePrivate.maximizedLeft = false;
315+ appDelegatePrivate.maximizedLeft = false;
320− appDelegatePrivate.maximizedRight = false;
316+ appDelegatePrivate.maximizedRight = false;
322− function maximizeLeft() {
318+ function maximizeLeft() {
323− appDelegatePrivate.minimized = false;
319+ appDelegatePrivate.minimized = false;
324− appDelegatePrivate.maximized = false;
320+ appDelegatePrivate.maximized = false;
325− appDelegatePrivate.maximizedLeft = true;
321+ appDelegatePrivate.maximizedLeft = true;
326− appDelegatePrivate.maximizedRight = false;
322+ appDelegatePrivate.maximizedRight = false;
328− function maximizeRight() {
324+ function maximizeRight() {
329− appDelegatePrivate.minimized = false;
325+ appDelegatePrivate.minimized = false;
330− appDelegatePrivate.maximized = false;
326+ appDelegatePrivate.maximized = false;
331− appDelegatePrivate.maximizedLeft = false;
327+ appDelegatePrivate.maximizedLeft = false;
332− appDelegatePrivate.maximizedRight = true;
328+ appDelegatePrivate.maximizedRight = true;
334− function minimize(animated) {
330+ function minimize(animated) {
335− animationsEnabled = (animated === undefined) || animated;
331+ animationsEnabled = (animated === undefined) || animated;
336− appDelegatePrivate.minimized = true;
332+ appDelegatePrivate.minimized = true;
338− function restoreFromMaximized(animated) {
334+ function restoreFromMaximized(animated) {
339− animationsEnabled = (animated === undefined) || animated;
335+ animationsEnabled = (animated === undefined) || animated;
340− appDelegatePrivate.minimized = false;
336+ appDelegatePrivate.minimized = false;
341− appDelegatePrivate.maximized = false;
337+ appDelegatePrivate.maximized = false;
342− appDelegatePrivate.maximizedLeft = false;
338+ appDelegatePrivate.maximizedLeft = false;
343− appDelegatePrivate.maximizedRight = false;
339+ appDelegatePrivate.maximizedRight = false;
345− function restore(animated) {
341+ function restore(animated) {
346− animationsEnabled = (animated === undefined) || animated;
342+ animationsEnabled = (animated === undefined) || animated;
347− appDelegatePrivate.minimized = false;
343+ appDelegatePrivate.minimized = false;
348− if (maximized)
344+ if (maximized)
349− maximize();
345+ maximize();
350− else if (maximizedLeft)
346+ else if (maximizedLeft)
351− maximizeLeft();
347+ maximizeLeft();
352− else if (maximizedRight)
348+ else if (maximizedRight)
353− maximizeRight();
349+ maximizeRight();
354− ApplicationManager.focusApplication(appId);
350+ ApplicationManager.focusApplication(appId);
357− states: [
353+ states: [
359− name: "fullscreen"; when: decoratedWindow.fullscreen
355+ name: "fullscreen"; when: decoratedWindow.fullscreen
362− target: appDelegate;
363− y: -PanelState.panelHeight
368− when: !appDelegate.maximized && !appDelegate.minimized
369− && !appDelegate.maximizedLeft && !appDelegate.maximizedRight
370− PropertyChanges {
356+ PropertyChanges {
371− target: appDelegate;
372− visuallyMinimized: false;
373− visuallyMaximized: false
377− name: "maximized"; when: appDelegate.maximized && !appDelegate.minimized
379− target: appDelegate;
357+ target: appDelegate;
380− x: 0; y: 0;
358+ x: 0; y: -PanelState.panelHeight
381− requestedWidth: appContainer.width; requestedHeight: appContainer.height;
382− visuallyMinimized: false;
383− visuallyMaximized: true
387− name: "maximizedLeft"; when: appDelegate.maximizedLeft && !appDelegate.minimized
388− PropertyChanges { target: appDelegate; x: 0; y: PanelState.panelHeight;
389− requestedWidth: appContainer.width/2; requestedHeight: appContainer.height - PanelState.panelHeight }
392− name: "maximizedRight"; when: appDelegate.maximizedRight && !appDelegate.minimized
393− PropertyChanges { target: appDelegate; x: appContainer.width/2; y: PanelState.panelHeight;
394− requestedWidth: appContainer.width/2; requestedHeight: appContainer.height - PanelState.panelHeight }
359+ requestedWidth: appContainer.width; requestedHeight: appContainer.height;
397− name: "minimized"; when: appDelegate.minimized
399− target: appDelegate;
400− x: -appDelegate.width / 2;
401− scale: units.gu(5) / appDelegate.width;
403− visuallyMinimized: true;
404− visuallyMaximized: false
364+ when: !appDelegate.maximized && !appDelegate.minimized
365+ && !appDelegate.maximizedLeft && !appDelegate.maximizedRight
367+ target: appDelegate;
368+ visuallyMinimized: false;
369+ visuallyMaximized: false
373+ name: "maximized"; when: appDelegate.maximized && !appDelegate.minimized
375+ target: appDelegate;
376+ x: root.leftMargin; y: 0;
377+ requestedWidth: appContainer.width - root.leftMargin; requestedHeight: appContainer.height;
378+ visuallyMinimized: false;
379+ visuallyMaximized: true
383+ name: "maximizedLeft"; when: appDelegate.maximizedLeft && !appDelegate.minimized
384+ PropertyChanges { target: appDelegate; x: root.leftMargin; y: PanelState.panelHeight;
385+ requestedWidth: (appContainer.width - root.leftMargin)/2; requestedHeight: appContainer.height - PanelState.panelHeight }
388+ name: "maximizedRight"; when: appDelegate.maximizedRight && !appDelegate.minimized
389+ PropertyChanges { target: appDelegate; x: (appContainer.width + root.leftMargin)/2; y: PanelState.panelHeight;
390+ requestedWidth: (appContainer.width - root.leftMargin)/2; requestedHeight: appContainer.height - PanelState.panelHeight }
393+ name: "minimized"; when: appDelegate.minimized
395+ target: appDelegate;
396+ x: -appDelegate.width / 2;
397+ scale: units.gu(5) / appDelegate.width;
399+ visuallyMinimized: true;
400+ visuallyMaximized: false
408− transitions: [
404+ transitions: [
409− Transition {
405+ Transition {
410− to: "normal"
406+ to: "normal"
411− enabled: appDelegate.animationsEnabled
407+ enabled: appDelegate.animationsEnabled
412− PropertyAction { target: appDelegate; properties: "visuallyMinimized,visuallyMaximized" }
408+ PropertyAction { target: appDelegate; properties: "visuallyMinimized,visuallyMaximized" }
409+ UbuntuNumberAnimation { target: appDelegate; properties: "x,y,opacity,requestedWidth,requestedHeight,scale"; duration: UbuntuAnimation.FastDuration }
413+ enabled: appDelegate.animationsEnabled
414+ PropertyAction { target: appDelegate; property: "visuallyMaximized" }
415+ SequentialAnimation {
413 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,opacity,requestedWidth,requestedHeight,scale"; duration: UbuntuAnimation.FastDuration }
416 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,opacity,requestedWidth,requestedHeight,scale"; duration: UbuntuAnimation.FastDuration }
417− enabled: appDelegate.animationsEnabled
418− PropertyAction { target: appDelegate; property: "visuallyMaximized" }
419− SequentialAnimation {
420− UbuntuNumberAnimation { target: appDelegate; properties: "x,y,opacity,requestedWidth,requestedHeight,scale"; duration: UbuntuAnimation.FastDuration }
421− PropertyAction { target: appDelegate; property: "visuallyMinimized" }
417+ PropertyAction { target: appDelegate; property: "visuallyMinimized" }
422− ScriptAction {
418+ ScriptAction {
423− script: {
419+ script: {
424− if (appDelegate.minimized) {
420+ if (appDelegate.minimized) {
425− priv.focusNext();
421+ priv.focusNext();
432− to: "*" //maximized and fullscreen
433− enabled: appDelegate.animationsEnabled
434− PropertyAction { target: appDelegate; property: "visuallyMinimized" }
435− SequentialAnimation {
436− UbuntuNumberAnimation { target: appDelegate; properties: "x,y,opacity,requestedWidth,requestedHeight,scale"; duration: UbuntuAnimation.FastDuration }
437− PropertyAction { target: appDelegate; property: "visuallyMaximized" }
442− Binding {
428+ to: "*" //maximized and fullscreen
444− target: appDelegate
429+ enabled: appDelegate.animationsEnabled
445− property: "z"
430+ PropertyAction { target: appDelegate; property: "visuallyMinimized" }
446− value: ApplicationManager.count + 1
431+ SequentialAnimation {
447− when: index == spread.highlightedIndex && blurLayer.ready
432+ UbuntuNumberAnimation { target: appDelegate; properties: "x,y,opacity,requestedWidth,requestedHeight,scale"; duration: UbuntuAnimation.FastDuration }
433+ PropertyAction { target: appDelegate; property: "visuallyMaximized" }
442+ value: ApplicationManager.count + 1
443+ when: index == spread.highlightedIndex && blurLayer.ready
450− WindowResizeArea {
446+ WindowResizeArea {
451− objectName: "windowResizeArea"
447+ objectName: "windowResizeArea"
452− target: appDelegate
448+ target: appDelegate
453− minWidth: units.gu(10)
449+ minWidth: units.gu(10)
454− minHeight: units.gu(10)
450+ minHeight: units.gu(10)
455− borderThickness: units.gu(2)
451+ borderThickness: units.gu(2)
456− windowId: model.appId // FIXME: Change this to point to windowId once we have such a thing
452+ windowId: model.appId // FIXME: Change this to point to windowId once we have such a thing
457− screenWidth: appContainer.width
453+ screenWidth: appContainer.width
458− screenHeight: appContainer.height
454+ screenHeight: appContainer.height
459−
455+ leftMargin: root.leftMargin
460− onPressed: { ApplicationManager.focusApplication(model.appId) }
457+ onPressed: { ApplicationManager.focusApplication(model.appId) }
463− DecoratedWindow {
460+ DecoratedWindow {
464− id: decoratedWindow
461+ id: decoratedWindow
465− objectName: "decoratedWindow"
462+ objectName: "decoratedWindow"
466− anchors.left: appDelegate.left
463+ anchors.left: appDelegate.left
467− anchors.top: appDelegate.top
464+ anchors.top: appDelegate.top
468− application: ApplicationManager.get(index)
465+ application: ApplicationManager.get(index)
469− active: ApplicationManager.focusedApplicationId === model.appId
466+ active: ApplicationManager.focusedApplicationId === model.appId
470− focus: true
467+ focus: true
472− onClose: ApplicationManager.stopApplication(model.appId)
469+ onClose: ApplicationManager.stopApplication(model.appId)
473− onMaximize: appDelegate.maximized || appDelegate.maximizedLeft || appDelegate.maximizedRight
470+ onMaximize: appDelegate.maximized || appDelegate.maximizedLeft || appDelegate.maximizedRight
474− ? appDelegate.restoreFromMaximized() : appDelegate.maximize()
471+ ? appDelegate.restoreFromMaximized() : appDelegate.maximize()
475− onMinimize: appDelegate.minimize()
472+ onMinimize: appDelegate.minimize()
476− onDecorationPressed: { ApplicationManager.focusApplication(model.appId) }
473+ onDecorationPressed: { ApplicationManager.focusApplication(model.appId) }
@@ -482,8 +478,8 @@ AbstractStage {
483 BlurLayer {
479 BlurLayer {
484 id: blurLayer
480 id: blurLayer
485− anchors.fill: stageContainer
481+ anchors.fill: appContainer
486− source: stageContainer
482+ source: appContainer
487 visible: false
483 visible: false
@@ -534,7 +530,7 @@ AbstractStage {
534 DesktopSpread {
530 DesktopSpread {
535 id: spread
531 id: spread
536 objectName: "spread"
532 objectName: "spread"
537− anchors.fill: stageContainer
533+ anchors.fill: appContainer
538 workspace: appContainer
534 workspace: appContainer
539 focus: state == "altTab"
535 focus: state == "altTab"
540 altTabPressed: root.altTabPressed
536 altTabPressed: root.altTabPressed