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