@@ -47,6 +47,7 @@ FocusScope {
47 property bool oskEnabled: false
47 property bool oskEnabled: false
48 property rect inputMethodRect
48 property rect inputMethodRect
49 property real rightEdgePushProgress: 0
49 property real rightEdgePushProgress: 0
50+ property PanelState panelState
51 // Configuration
52 // Configuration
52 property string mode: "staged"
53 property string mode: "staged"
@@ -349,23 +350,23 @@ FocusScope {
349 readonly property real virtualKeyboardHeight: root.inputMethodRect.height
350 readonly property real virtualKeyboardHeight: root.inputMethodRect.height
352− Component.onCompleted: priv.updateMainAndSideStageIndexes();
353+ Component.onCompleted: {priv.updateMainAndSideStageIndexes(); print("size", root.width, root.height)}
354 Connections {
355 Connections {
355− target: PanelState
356+ target: panelState
356 onCloseClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.close(); } }
357 onCloseClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.close(); } }
357 onMinimizeClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.requestMinimize(); } }
358 onMinimizeClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.requestMinimize(); } }
358 onRestoreClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.requestRestore(); } }
359 onRestoreClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.requestRestore(); } }
361 Binding {
362 Binding {
362− target: PanelState
363+ target: panelState
363 property: "decorationsVisible"
364 property: "decorationsVisible"
364 value: priv.focusedAppDelegate !== null && priv.focusedAppDelegate.maximized // FIXME for Locally integrated menus
365 value: priv.focusedAppDelegate !== null && priv.focusedAppDelegate.maximized // FIXME for Locally integrated menus
367 Binding {
368 Binding {
368− target: PanelState
369+ target: panelState
369 property: "title"
370 property: "title"
371 if (priv.focusedAppDelegate !== null) {
372 if (priv.focusedAppDelegate !== null) {
@@ -380,7 +381,7 @@ FocusScope {
382 Binding {
383 Binding {
383− target: PanelState
384+ target: panelState
384 property: "focusedPersistentSurfaceId"
385 property: "focusedPersistentSurfaceId"
386 if (priv.focusedAppDelegate !== null) {
387 if (priv.focusedAppDelegate !== null) {
@@ -394,21 +395,21 @@ FocusScope {
396 Binding {
397 Binding {
397− target: PanelState
398+ target: panelState
398 property: "dropShadow"
399 property: "dropShadow"
399 value: priv.focusedAppDelegate && !priv.focusedAppDelegate.maximized && priv.foregroundMaximizedAppDelegate !== null && mode == "windowed"
400 value: priv.focusedAppDelegate && !priv.focusedAppDelegate.maximized && priv.foregroundMaximizedAppDelegate !== null && mode == "windowed"
402 Binding {
403 Binding {
403− target: PanelState
404+ target: panelState
404 property: "closeButtonShown"
405 property: "closeButtonShown"
405 value: priv.focusedAppDelegate && priv.focusedAppDelegate.maximized && !priv.focusedAppDelegate.isDash
406 value: priv.focusedAppDelegate && priv.focusedAppDelegate.maximized && !priv.focusedAppDelegate.isDash
408 Component.onDestruction: {
409 Component.onDestruction: {
409− PanelState.title = "";
410+ panelState.title = "";
410− PanelState.decorationsVisible = false;
411+ panelState.decorationsVisible = false;
411− PanelState.dropShadow = false;
412+ panelState.dropShadow = false;
414 Instantiator {
415 Instantiator {
@@ -454,6 +455,7 @@ FocusScope {
454 PropertyChanges { target: cancelSpreadMouseArea; enabled: true }
455 PropertyChanges { target: cancelSpreadMouseArea; enabled: true }
455 PropertyChanges { target: blurLayer; visible: true; blurRadius: 32; brightness: .65; opacity: 1 }
456 PropertyChanges { target: blurLayer; visible: true; blurRadius: 32; brightness: .65; opacity: 1 }
456 PropertyChanges { target: wallpaper; visible: false }
457 PropertyChanges { target: wallpaper; visible: false }
458+ PropertyChanges { target: screensAndWorkspaces; opacity: 1 }
459 name: "stagedRightEdge"; when: root.spreadEnabled && (rightEdgeDragArea.dragging || rightEdgePushProgress > 0) && root.mode == "staged"
461 name: "stagedRightEdge"; when: root.spreadEnabled && (rightEdgeDragArea.dragging || rightEdgePushProgress > 0) && root.mode == "staged"
@@ -502,10 +504,13 @@ FocusScope {
502 from: "stagedRightEdge,sideStagedRightEdge,windowedRightEdge"; to: "spread"
504 from: "stagedRightEdge,sideStagedRightEdge,windowedRightEdge"; to: "spread"
503 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: -1 }
505 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: -1 }
504 PropertyAnimation { target: blurLayer; properties: "brightness,blurRadius"; duration: priv.animationDuration }
506 PropertyAnimation { target: blurLayer; properties: "brightness,blurRadius"; duration: priv.animationDuration }
507+ UbuntuNumberAnimation { target: screensAndWorkspaces; property: "opacity"; duration: priv.animationDuration }
506 Transition {
509 Transition {
507 to: "spread"
510 to: "spread"
508 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: appRepeater.count > 1 ? 1 : 0 }
511 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: appRepeater.count > 1 ? 1 : 0 }
512+ PropertyAction { target: floatingFlickable; property: "contentX"; value: 0 }
513+ UbuntuNumberAnimation { target: screensAndWorkspaces; property: "opacity"; duration: priv.animationDuration }
510 Transition {
515 Transition {
511 from: "spread"
516 from: "spread"
@@ -563,10 +568,19 @@ FocusScope {
563 visible: false
568 visible: false
571+ ScreensAndWorkspaces {
572+ id: screensAndWorkspaces
573+ anchors { left: parent.left; top: parent.top; right: parent.right; leftMargin: root.leftMargin }
574+ height: parent.height / 3
575+ background: root.background
577+ visible: opacity > 0
567 id: spreadItem
581 id: spreadItem
568 objectName: "spreadItem"
582 objectName: "spreadItem"
569− anchors.fill: appContainer
583+ anchors { left: parent.left; bottom: parent.bottom; right: parent.right; top: screensAndWorkspaces.bottom }
570 leftMargin: root.leftMargin
584 leftMargin: root.leftMargin
571 model: root.topLevelSurfaceList
585 model: root.topLevelSurfaceList
572 spreadFlickable: floatingFlickable
586 spreadFlickable: floatingFlickable
@@ -575,6 +589,83 @@ FocusScope {
575 onLeaveSpread: {
589 onLeaveSpread: {
576 priv.goneToSpread = false;
590 priv.goneToSpread = false;
594+ id: floatingFlickable
595+ objectName: "spreadFlickable"
596+ anchors.fill: parent
598+ contentWidth: spreadItem.spreadTotalWidth
600+ function snap(toIndex) {
601+ var delegate = appRepeater.itemAt(toIndex)
602+ var targetContentX = floatingFlickable.contentWidth / spreadItem.totalItemCount * toIndex;
603+ if (targetContentX - floatingFlickable.contentX > spreadItem.rightStackXPos - (spreadItem.spreadItemWidth / 2)) {
604+ var offset = (spreadItem.rightStackXPos - (spreadItem.spreadItemWidth / 2)) - (targetContentX - floatingFlickable.contentX)
605+ snapAnimation.to = floatingFlickable.contentX - offset;
606+ snapAnimation.start();
607+ } else if (targetContentX - floatingFlickable.contentX < spreadItem.leftStackXPos + units.gu(1)) {
608+ var offset = (spreadItem.leftStackXPos + units.gu(1)) - (targetContentX - floatingFlickable.contentX);
609+ snapAnimation.to = floatingFlickable.contentX - offset;
610+ snapAnimation.start();
613+ UbuntuNumberAnimation {id: snapAnimation; target: floatingFlickable; property: "contentX"}
618+ objectName: "hoverMouseArea"
619+ anchors.fill: parent
620+ propagateComposedEvents: true
625+ property int scrollAreaWidth: width / 3
626+ property bool progressiveScrollingEnabled: false
628+ onPressed: mouse.accepted = false
631+ mouse.accepted = false
633+ if (hoverMouseArea.pressed) {
637+ // Find the hovered item and mark it active
638+ for (var i = appRepeater.count - 1; i >= 0; i--) {
639+ var appDelegate = appRepeater.itemAt(i);
640+ var mapped = mapToItem(appDelegate, hoverMouseArea.mouseX, hoverMouseArea.mouseY)
641+ var itemUnder = appDelegate.childAt(mapped.x, mapped.y);
642+ if (itemUnder && (itemUnder.objectName === "dragArea" || itemUnder.objectName === "windowInfoItem" || itemUnder.objectName == "closeMouseArea")) {
643+ spreadItem.highlightedIndex = i;
648+ if (floatingFlickable.contentWidth > floatingFlickable.width) {
649+ var margins = floatingFlickable.width * 0.05;
651+ if (!progressiveScrollingEnabled && mouseX < floatingFlickable.width - scrollAreaWidth) {
652+ progressiveScrollingEnabled = true
655+ // do we need to scroll?
656+ if (mouseX < scrollAreaWidth + margins) {
657+ var progress = Math.min(1, (scrollAreaWidth + margins - mouseX) / (scrollAreaWidth - margins));
658+ var contentX = (1 - progress) * (floatingFlickable.contentWidth - floatingFlickable.width)
659+ floatingFlickable.contentX = Math.max(0, Math.min(floatingFlickable.contentX, contentX))
661+ if (mouseX > floatingFlickable.width - scrollAreaWidth && progressiveScrollingEnabled) {
662+ var progress = Math.min(1, (mouseX - (floatingFlickable.width - scrollAreaWidth)) / (scrollAreaWidth - margins))
663+ var contentX = progress * (floatingFlickable.contentWidth - floatingFlickable.width)
664+ floatingFlickable.contentX = Math.min(floatingFlickable.contentWidth - floatingFlickable.width, Math.max(floatingFlickable.contentX, contentX))
580 Connections {
671 Connections {
@@ -669,10 +760,27 @@ FocusScope {
765+ property real previewScale: .5
766+ width: implicitWidth * previewScale
767+ height: implicitHeight * previewScale
770+ opacity: surface != null ? 1 : 0
771+ Behavior on opacity { UbuntuNumberAnimation {} }
772+ visible: opacity > 0
774+ Drag.active: surface != null
775+ Drag.keys: ["application"]
673 id: boundariesForWindowPlacement
781 id: boundariesForWindowPlacement
674 anchors.fill: parent
782 anchors.fill: parent
675− anchors.topMargin: PanelState.panelHeight
783+ anchors.topMargin: panelState.panelHeight
676 visible: false
784 visible: false
@@ -704,6 +812,9 @@ FocusScope {
705 z: normalZ
813 z: normalZ
815+ opacity: fakeDragItem.surface == model.window.surface && fakeDragItem.Drag.active ? 0 : 1
816+ Behavior on opacity { UbuntuNumberAnimation {} }
707 // Normally we want x/y where the surface thinks it is. Width/height of our delegate will
818 // Normally we want x/y where the surface thinks it is. Width/height of our delegate will
708 // match what the actual surface size is.
819 // match what the actual surface size is.
709 // Don't write to those, they will be set by states
820 // Don't write to those, they will be set by states
@@ -764,7 +875,7 @@ FocusScope {
764 target: appDelegate
875 target: appDelegate
765 property: "y"
876 property: "y"
766 value: appDelegate.requestedY -
877 value: appDelegate.requestedY -
767− Math.min(appDelegate.requestedY - PanelState.panelHeight,
878+ Math.min(appDelegate.requestedY - panelState.panelHeight,
768 Math.max(0, priv.virtualKeyboardHeight - (appContainer.height - (appDelegate.requestedY + appDelegate.height))))
879 Math.max(0, priv.virtualKeyboardHeight - (appContainer.height - (appDelegate.requestedY + appDelegate.height))))
769 when: root.oskEnabled && appDelegate.focus && (appDelegate.state == "normal" || appDelegate.state == "restored")
880 when: root.oskEnabled && appDelegate.focus && (appDelegate.state == "normal" || appDelegate.state == "restored")
770 && root.inputMethodRect.height > 0
881 && root.inputMethodRect.height > 0
@@ -1148,7 +1259,7 @@ FocusScope {
1148 progress: 0
1259 progress: 0
1149 targetHeight: spreadItem.stackHeight
1260 targetHeight: spreadItem.stackHeight
1150 targetX: spreadMaths.targetX
1261 targetX: spreadMaths.targetX
1151− startY: appDelegate.fullscreen ? 0 : PanelState.panelHeight
1262+ startY: appDelegate.fullscreen ? 0 : panelState.panelHeight
1152 targetY: spreadMaths.targetY
1263 targetY: spreadMaths.targetY
1153 targetAngle: spreadMaths.targetAngle
1264 targetAngle: spreadMaths.targetAngle
1154 targetScale: spreadMaths.targetScale
1265 targetScale: spreadMaths.targetScale
@@ -1267,9 +1378,9 @@ FocusScope {
1267 PropertyChanges {
1378 PropertyChanges {
1268 target: appDelegate
1379 target: appDelegate
1269 x: stageMaths.itemX
1380 x: stageMaths.itemX
1270− y: appDelegate.fullscreen ? 0 : PanelState.panelHeight
1381+ y: appDelegate.fullscreen ? 0 : panelState.panelHeight
1271 requestedWidth: appContainer.width
1382 requestedWidth: appContainer.width
1272− requestedHeight: appDelegate.fullscreen ? appContainer.height : appContainer.height - PanelState.panelHeight
1383+ requestedHeight: appDelegate.fullscreen ? appContainer.height : appContainer.height - panelState.panelHeight
1273 visuallyMaximized: true
1384 visuallyMaximized: true
1274 visible: appDelegate.x < root.width
1385 visible: appDelegate.x < root.width
@@ -1295,10 +1406,10 @@ FocusScope {
1295 PropertyChanges {
1406 PropertyChanges {
1296 target: appDelegate
1407 target: appDelegate
1297 x: stageMaths.itemX
1408 x: stageMaths.itemX
1298− y: appDelegate.fullscreen ? 0 : PanelState.panelHeight
1409+ y: appDelegate.fullscreen ? 0 : panelState.panelHeight
1299 z: stageMaths.itemZ
1410 z: stageMaths.itemZ
1300 requestedWidth: stageMaths.itemWidth
1411 requestedWidth: stageMaths.itemWidth
1301− requestedHeight: appDelegate.fullscreen ? appContainer.height : appContainer.height - PanelState.panelHeight
1412+ requestedHeight: appDelegate.fullscreen ? appContainer.height : appContainer.height - panelState.panelHeight
1302 visuallyMaximized: true
1413 visuallyMaximized: true
1303 visible: appDelegate.x < root.width
1414 visible: appDelegate.x < root.width
@@ -1363,9 +1474,9 @@ FocusScope {
1363 PropertyChanges {
1474 PropertyChanges {
1364 target: appDelegate
1475 target: appDelegate
1365 windowedX: root.leftMargin
1476 windowedX: root.leftMargin
1366− windowedY: PanelState.panelHeight
1477+ windowedY: panelState.panelHeight
1367 windowedWidth: (appContainer.width - root.leftMargin)/2
1478 windowedWidth: (appContainer.width - root.leftMargin)/2
1368− windowedHeight: appContainer.height - PanelState.panelHeight
1479+ windowedHeight: appContainer.height - panelState.panelHeight
@@ -1382,9 +1493,9 @@ FocusScope {
1382 PropertyChanges {
1493 PropertyChanges {
1383 target: appDelegate
1494 target: appDelegate
1384 windowedX: root.leftMargin
1495 windowedX: root.leftMargin
1385− windowedY: PanelState.panelHeight
1496+ windowedY: panelState.panelHeight
1386 windowedWidth: (appContainer.width - root.leftMargin)/2
1497 windowedWidth: (appContainer.width - root.leftMargin)/2
1387− windowedHeight: (appContainer.height - PanelState.panelHeight)/2
1498+ windowedHeight: (appContainer.height - panelState.panelHeight)/2
@@ -1401,7 +1512,7 @@ FocusScope {
1401 PropertyChanges {
1512 PropertyChanges {
1402 target: appDelegate
1513 target: appDelegate
1403 windowedX: root.leftMargin
1514 windowedX: root.leftMargin
1404− windowedY: (appContainer.height + PanelState.panelHeight)/2
1515+ windowedY: (appContainer.height + panelState.panelHeight)/2
1405 windowedWidth: (appContainer.width - root.leftMargin)/2
1516 windowedWidth: (appContainer.width - root.leftMargin)/2
1406 windowedHeight: appContainer.height/2
1517 windowedHeight: appContainer.height/2
@@ -1423,8 +1534,8 @@ FocusScope {
1424 name: "maximizedVertically"; when: appDelegate.maximizedVertically && !appDelegate.minimized
1535 name: "maximizedVertically"; when: appDelegate.maximizedVertically && !appDelegate.minimized
1425 extend: "normal"
1536 extend: "normal"
1426− PropertyChanges { target: appDelegate; windowedX: windowedX; windowedY: PanelState.panelHeight;
1537+ PropertyChanges { target: appDelegate; windowedX: windowedX; windowedY: panelState.panelHeight;
1427− windowedWidth: windowedWidth; windowedHeight: appContainer.height - PanelState.panelHeight }
1538+ windowedWidth: windowedWidth; windowedHeight: appContainer.height - panelState.panelHeight }
1430 name: "minimized"; when: appDelegate.minimized
1541 name: "minimized"; when: appDelegate.minimized
@@ -1540,7 +1651,7 @@ FocusScope {
1542 Binding {
1653 Binding {
1543− target: PanelState
1654+ target: panelState
1544 property: "decorationsAlwaysVisible"
1655 property: "decorationsAlwaysVisible"
1545 value: appDelegate && appDelegate.maximized && touchControls.overlayShown
1656 value: appDelegate && appDelegate.maximized && touchControls.overlayShown
@@ -1785,83 +1896,7 @@ FocusScope {
1785 leftMargin: root.leftMargin
1896 leftMargin: root.leftMargin
1786 appContainerWidth: appContainer.width
1897 appContainerWidth: appContainer.width
1787 appContainerHeight: appContainer.height
1898 appContainerHeight: appContainer.height
1788− }
1899+ panelState: root.panelState
1792− objectName: "hoverMouseArea"
1793− anchors.fill: appContainer
1794− propagateComposedEvents: true
1799− property int scrollAreaWidth: width / 3
1800− property bool progressiveScrollingEnabled: false
1803− mouse.accepted = false
1805− if (hoverMouseArea.pressed) {
1809− // Find the hovered item and mark it active
1810− for (var i = appRepeater.count - 1; i >= 0; i--) {
1811− var appDelegate = appRepeater.itemAt(i);
1812− var mapped = mapToItem(appDelegate, hoverMouseArea.mouseX, hoverMouseArea.mouseY)
1813− var itemUnder = appDelegate.childAt(mapped.x, mapped.y);
1814− if (itemUnder && (itemUnder.objectName === "dragArea" || itemUnder.objectName === "windowInfoItem" || itemUnder.objectName == "closeMouseArea")) {
1815− spreadItem.highlightedIndex = i;
1820− if (floatingFlickable.contentWidth > floatingFlickable.width) {
1821− var margins = floatingFlickable.width * 0.05;
1823− if (!progressiveScrollingEnabled && mouseX < floatingFlickable.width - scrollAreaWidth) {
1824− progressiveScrollingEnabled = true
1827− // do we need to scroll?
1828− if (mouseX < scrollAreaWidth + margins) {
1829− var progress = Math.min(1, (scrollAreaWidth + margins - mouseX) / (scrollAreaWidth - margins));
1830− var contentX = (1 - progress) * (floatingFlickable.contentWidth - floatingFlickable.width)
1831− floatingFlickable.contentX = Math.max(0, Math.min(floatingFlickable.contentX, contentX))
1833− if (mouseX > floatingFlickable.width - scrollAreaWidth && progressiveScrollingEnabled) {
1834− var progress = Math.min(1, (mouseX - (floatingFlickable.width - scrollAreaWidth)) / (scrollAreaWidth - margins))
1835− var contentX = progress * (floatingFlickable.contentWidth - floatingFlickable.width)
1836− floatingFlickable.contentX = Math.min(floatingFlickable.contentWidth - floatingFlickable.width, Math.max(floatingFlickable.contentX, contentX))
1841− onPressed: mouse.accepted = false
1844− FloatingFlickable {
1845− id: floatingFlickable
1846− objectName: "spreadFlickable"
1847− anchors.fill: appContainer
1849− contentWidth: spreadItem.spreadTotalWidth
1851− function snap(toIndex) {
1852− var delegate = appRepeater.itemAt(toIndex)
1853− var targetContentX = floatingFlickable.contentWidth / spreadItem.totalItemCount * toIndex;
1854− if (targetContentX - floatingFlickable.contentX > spreadItem.rightStackXPos - (spreadItem.spreadItemWidth / 2)) {
1855− var offset = (spreadItem.rightStackXPos - (spreadItem.spreadItemWidth / 2)) - (targetContentX - floatingFlickable.contentX)
1856− snapAnimation.to = Math.max(0, floatingFlickable.contentX - offset);
1857− snapAnimation.start();
1858− } else if (targetContentX - floatingFlickable.contentX < spreadItem.leftStackXPos + units.gu(1)) {
1859− var offset = (spreadItem.leftStackXPos + units.gu(1)) - (targetContentX - floatingFlickable.contentX);
1860− snapAnimation.to = Math.max(0, floatingFlickable.contentX - offset);
1861− snapAnimation.start();
1864− UbuntuNumberAnimation {id: snapAnimation; target: floatingFlickable; property: "contentX"}
1867 PropertyAnimation {
1902 PropertyAnimation {