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