@@ -46,6 +46,7 @@ FocusScope {
46 property int leftMargin: 0
46 property int leftMargin: 0
47 property bool oskEnabled: false
47 property bool oskEnabled: false
48 property rect inputMethodRect
48 property rect inputMethodRect
49+ property PanelState panelState
50 // Configuration
51 // Configuration
51 property string mode: "staged"
52 property string mode: "staged"
@@ -345,23 +346,23 @@ FocusScope {
345 readonly property real virtualKeyboardHeight: root.inputMethodRect.height
346 readonly property real virtualKeyboardHeight: root.inputMethodRect.height
348− Component.onCompleted: priv.updateMainAndSideStageIndexes();
349+ Component.onCompleted: {priv.updateMainAndSideStageIndexes(); print("size", root.width, root.height)}
350 Connections {
351 Connections {
351− target: PanelState
352+ target: panelState
352 onCloseClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.close(); } }
353 onCloseClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.close(); } }
353 onMinimizeClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.requestMinimize(); } }
354 onMinimizeClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.requestMinimize(); } }
354 onRestoreClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.requestRestore(); } }
355 onRestoreClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.requestRestore(); } }
357 Binding {
358 Binding {
358− target: PanelState
359+ target: panelState
359 property: "decorationsVisible"
360 property: "decorationsVisible"
360 value: priv.focusedAppDelegate !== null && priv.focusedAppDelegate.maximized // FIXME for Locally integrated menus
361 value: priv.focusedAppDelegate !== null && priv.focusedAppDelegate.maximized // FIXME for Locally integrated menus
363 Binding {
364 Binding {
364− target: PanelState
365+ target: panelState
365 property: "title"
366 property: "title"
367 if (priv.focusedAppDelegate !== null) {
368 if (priv.focusedAppDelegate !== null) {
@@ -376,7 +377,7 @@ FocusScope {
378 Binding {
379 Binding {
379− target: PanelState
380+ target: panelState
380 property: "focusedPersistentSurfaceId"
381 property: "focusedPersistentSurfaceId"
382 if (priv.focusedAppDelegate !== null) {
383 if (priv.focusedAppDelegate !== null) {
@@ -390,21 +391,21 @@ FocusScope {
392 Binding {
393 Binding {
393− target: PanelState
394+ target: panelState
394 property: "dropShadow"
395 property: "dropShadow"
395 value: priv.focusedAppDelegate && !priv.focusedAppDelegate.maximized && priv.foregroundMaximizedAppDelegate !== null && mode == "windowed"
396 value: priv.focusedAppDelegate && !priv.focusedAppDelegate.maximized && priv.foregroundMaximizedAppDelegate !== null && mode == "windowed"
398 Binding {
399 Binding {
399− target: PanelState
400+ target: panelState
400 property: "closeButtonShown"
401 property: "closeButtonShown"
401 value: priv.focusedAppDelegate && priv.focusedAppDelegate.maximized && !priv.focusedAppDelegate.isDash
402 value: priv.focusedAppDelegate && priv.focusedAppDelegate.maximized && !priv.focusedAppDelegate.isDash
404 Component.onDestruction: {
405 Component.onDestruction: {
405− PanelState.title = "";
406+ panelState.title = "";
406− PanelState.decorationsVisible = false;
407+ panelState.decorationsVisible = false;
407− PanelState.dropShadow = false;
408+ panelState.dropShadow = false;
410 Instantiator {
411 Instantiator {
@@ -450,6 +451,7 @@ FocusScope {
450 PropertyChanges { target: cancelSpreadMouseArea; enabled: true }
451 PropertyChanges { target: cancelSpreadMouseArea; enabled: true }
451 PropertyChanges { target: blurLayer; visible: true; blurRadius: 32; brightness: .65; opacity: 1 }
452 PropertyChanges { target: blurLayer; visible: true; blurRadius: 32; brightness: .65; opacity: 1 }
452 PropertyChanges { target: wallpaper; visible: false }
453 PropertyChanges { target: wallpaper; visible: false }
454+ PropertyChanges { target: screensAndWorkspaces; opacity: 1 }
455 name: "stagedRightEdge"; when: (rightEdgeDragArea.dragging || edgeBarrier.progress > 0) && root.mode == "staged"
457 name: "stagedRightEdge"; when: (rightEdgeDragArea.dragging || edgeBarrier.progress > 0) && root.mode == "staged"
@@ -482,7 +484,7 @@ FocusScope {
484 name: "staged"; when: root.mode === "staged"
486 name: "staged"; when: root.mode === "staged"
485− PropertyChanges { target: wallpaper; visible: false }
487+ PropertyChanges { target: wallpaper; visible: priv.focusedAppDelegate && priv.focusedAppDelegate.x === 0 }
488 name: "stagedWithSideStage"; when: root.mode === "stagedWithSideStage"
490 name: "stagedWithSideStage"; when: root.mode === "stagedWithSideStage"
@@ -498,11 +500,13 @@ FocusScope {
498 from: "stagedRightEdge,sideStagedRightEdge,windowedRightEdge"; to: "spread"
500 from: "stagedRightEdge,sideStagedRightEdge,windowedRightEdge"; to: "spread"
499 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: -1 }
501 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: -1 }
500 PropertyAnimation { target: blurLayer; properties: "brightness,blurRadius"; duration: priv.animationDuration }
502 PropertyAnimation { target: blurLayer; properties: "brightness,blurRadius"; duration: priv.animationDuration }
503+ UbuntuNumberAnimation { target: screensAndWorkspaces; property: "opacity"; duration: priv.animationDuration }
502 Transition {
505 Transition {
503 to: "spread"
506 to: "spread"
504 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: appRepeater.count > 1 ? 1 : 0 }
507 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: appRepeater.count > 1 ? 1 : 0 }
505 PropertyAction { target: floatingFlickable; property: "contentX"; value: 0 }
508 PropertyAction { target: floatingFlickable; property: "contentX"; value: 0 }
509+ UbuntuNumberAnimation { target: screensAndWorkspaces; property: "opacity"; duration: priv.animationDuration }
507 Transition {
511 Transition {
508 from: "spread"
512 from: "spread"
@@ -559,10 +563,19 @@ FocusScope {
559 visible: false
563 visible: false
566+ ScreensAndWorkspaces {
567+ id: screensAndWorkspaces
568+ anchors { left: parent.left; top: parent.top; right: parent.right; leftMargin: root.leftMargin }
569+ height: parent.height / 3
570+ background: root.background
572+ visible: opacity > 0
563 id: spreadItem
576 id: spreadItem
564 objectName: "spreadItem"
577 objectName: "spreadItem"
565− anchors.fill: appContainer
578+ anchors { left: parent.left; bottom: parent.bottom; right: parent.right; top: screensAndWorkspaces.bottom }
566 leftMargin: root.leftMargin
579 leftMargin: root.leftMargin
567 model: root.topLevelSurfaceList
580 model: root.topLevelSurfaceList
568 spreadFlickable: floatingFlickable
581 spreadFlickable: floatingFlickable
@@ -571,6 +584,83 @@ FocusScope {
571 onLeaveSpread: {
584 onLeaveSpread: {
572 priv.goneToSpread = false;
585 priv.goneToSpread = false;
589+ id: floatingFlickable
590+ objectName: "spreadFlickable"
591+ anchors.fill: parent
593+ contentWidth: spreadItem.spreadTotalWidth
595+ function snap(toIndex) {
596+ var delegate = appRepeater.itemAt(toIndex)
597+ var targetContentX = floatingFlickable.contentWidth / spreadItem.totalItemCount * toIndex;
598+ if (targetContentX - floatingFlickable.contentX > spreadItem.rightStackXPos - (spreadItem.spreadItemWidth / 2)) {
599+ var offset = (spreadItem.rightStackXPos - (spreadItem.spreadItemWidth / 2)) - (targetContentX - floatingFlickable.contentX)
600+ snapAnimation.to = floatingFlickable.contentX - offset;
601+ snapAnimation.start();
602+ } else if (targetContentX - floatingFlickable.contentX < spreadItem.leftStackXPos + units.gu(1)) {
603+ var offset = (spreadItem.leftStackXPos + units.gu(1)) - (targetContentX - floatingFlickable.contentX);
604+ snapAnimation.to = floatingFlickable.contentX - offset;
605+ snapAnimation.start();
608+ UbuntuNumberAnimation {id: snapAnimation; target: floatingFlickable; property: "contentX"}
613+ objectName: "hoverMouseArea"
614+ anchors.fill: parent
615+ propagateComposedEvents: true
620+ property int scrollAreaWidth: width / 3
621+ property bool progressiveScrollingEnabled: false
623+ onPressed: mouse.accepted = false
626+ mouse.accepted = false
628+ if (hoverMouseArea.pressed) {
632+ // Find the hovered item and mark it active
633+ for (var i = appRepeater.count - 1; i >= 0; i--) {
634+ var appDelegate = appRepeater.itemAt(i);
635+ var mapped = mapToItem(appDelegate, hoverMouseArea.mouseX, hoverMouseArea.mouseY)
636+ var itemUnder = appDelegate.childAt(mapped.x, mapped.y);
637+ if (itemUnder && (itemUnder.objectName === "dragArea" || itemUnder.objectName === "windowInfoItem" || itemUnder.objectName == "closeMouseArea")) {
638+ spreadItem.highlightedIndex = i;
643+ if (floatingFlickable.contentWidth > floatingFlickable.width) {
644+ var margins = floatingFlickable.width * 0.05;
646+ if (!progressiveScrollingEnabled && mouseX < floatingFlickable.width - scrollAreaWidth) {
647+ progressiveScrollingEnabled = true
650+ // do we need to scroll?
651+ if (mouseX < scrollAreaWidth + margins) {
652+ var progress = Math.min(1, (scrollAreaWidth + margins - mouseX) / (scrollAreaWidth - margins));
653+ var contentX = (1 - progress) * (floatingFlickable.contentWidth - floatingFlickable.width)
654+ floatingFlickable.contentX = Math.max(0, Math.min(floatingFlickable.contentX, contentX))
656+ if (mouseX > floatingFlickable.width - scrollAreaWidth && progressiveScrollingEnabled) {
657+ var progress = Math.min(1, (mouseX - (floatingFlickable.width - scrollAreaWidth)) / (scrollAreaWidth - margins))
658+ var contentX = progress * (floatingFlickable.contentWidth - floatingFlickable.width)
659+ floatingFlickable.contentX = Math.min(floatingFlickable.contentWidth - floatingFlickable.width, Math.max(floatingFlickable.contentX, contentX))
576 Connections {
666 Connections {
@@ -665,6 +755,23 @@ FocusScope {
760+ property real previewScale: .5
761+ width: implicitWidth * previewScale
762+ height: implicitHeight * previewScale
765+ opacity: surface != null ? 1 : 0
766+ Behavior on opacity { UbuntuNumberAnimation {} }
767+ visible: opacity > 0
769+ Drag.active: surface != null
770+ Drag.keys: ["application"]
669 id: boundariesForWindowPlacement
776 id: boundariesForWindowPlacement
670 anchors.fill: parent
777 anchors.fill: parent
@@ -700,6 +807,9 @@ FocusScope {
701 z: normalZ
808 z: normalZ
810+ opacity: fakeDragItem.surface == model.window.surface && fakeDragItem.Drag.active ? 0 : 1
811+ Behavior on opacity { UbuntuNumberAnimation {} }
703 // Normally we want x/y where the surface thinks it is. Width/height of our delegate will
813 // Normally we want x/y where the surface thinks it is. Width/height of our delegate will
704 // match what the actual surface size is.
814 // match what the actual surface size is.
705 // Don't write to those, they will be set by states
815 // Don't write to those, they will be set by states
@@ -760,7 +870,7 @@ FocusScope {
760 target: appDelegate
870 target: appDelegate
761 property: "y"
871 property: "y"
762 value: appDelegate.requestedY -
872 value: appDelegate.requestedY -
763− Math.min(appDelegate.requestedY - PanelState.panelHeight,
873+ Math.min(appDelegate.requestedY - panelState.panelHeight,
764 Math.max(0, priv.virtualKeyboardHeight - (appContainer.height - (appDelegate.requestedY + appDelegate.height))))
874 Math.max(0, priv.virtualKeyboardHeight - (appContainer.height - (appDelegate.requestedY + appDelegate.height))))
765 when: root.oskEnabled && appDelegate.focus && (appDelegate.state == "normal" || appDelegate.state == "restored")
875 when: root.oskEnabled && appDelegate.focus && (appDelegate.state == "normal" || appDelegate.state == "restored")
766 && root.inputMethodRect.height > 0
876 && root.inputMethodRect.height > 0
@@ -1136,7 +1246,7 @@ FocusScope {
1136 progress: 0
1246 progress: 0
1137 targetHeight: spreadItem.stackHeight
1247 targetHeight: spreadItem.stackHeight
1138 targetX: spreadMaths.targetX
1248 targetX: spreadMaths.targetX
1139− startY: appDelegate.fullscreen ? 0 : PanelState.panelHeight
1249+ startY: appDelegate.fullscreen ? 0 : panelState.panelHeight
1140 targetY: spreadMaths.targetY
1250 targetY: spreadMaths.targetY
1141 targetAngle: spreadMaths.targetAngle
1251 targetAngle: spreadMaths.targetAngle
1142 targetScale: spreadMaths.targetScale
1252 targetScale: spreadMaths.targetScale
@@ -1255,9 +1365,9 @@ FocusScope {
1255 PropertyChanges {
1365 PropertyChanges {
1256 target: appDelegate
1366 target: appDelegate
1257 x: stageMaths.itemX
1367 x: stageMaths.itemX
1258− y: appDelegate.fullscreen ? 0 : PanelState.panelHeight
1368+ y: appDelegate.fullscreen ? 0 : panelState.panelHeight
1259 requestedWidth: appContainer.width
1369 requestedWidth: appContainer.width
1260− requestedHeight: appDelegate.fullscreen ? appContainer.height : appContainer.height - PanelState.panelHeight
1370+ requestedHeight: appDelegate.fullscreen ? appContainer.height : appContainer.height - panelState.panelHeight
1261 visuallyMaximized: true
1371 visuallyMaximized: true
1262 visible: appDelegate.x < root.width
1372 visible: appDelegate.x < root.width
@@ -1283,10 +1393,10 @@ FocusScope {
1283 PropertyChanges {
1393 PropertyChanges {
1284 target: appDelegate
1394 target: appDelegate
1285 x: stageMaths.itemX
1395 x: stageMaths.itemX
1286− y: appDelegate.fullscreen ? 0 : PanelState.panelHeight
1396+ y: appDelegate.fullscreen ? 0 : panelState.panelHeight
1287 z: stageMaths.itemZ
1397 z: stageMaths.itemZ
1288 requestedWidth: stageMaths.itemWidth
1398 requestedWidth: stageMaths.itemWidth
1289− requestedHeight: appDelegate.fullscreen ? appContainer.height : appContainer.height - PanelState.panelHeight
1399+ requestedHeight: appDelegate.fullscreen ? appContainer.height : appContainer.height - panelState.panelHeight
1290 visuallyMaximized: true
1400 visuallyMaximized: true
1291 visible: appDelegate.x < root.width
1401 visible: appDelegate.x < root.width
@@ -1351,9 +1461,9 @@ FocusScope {
1351 PropertyChanges {
1461 PropertyChanges {
1352 target: appDelegate
1462 target: appDelegate
1353 windowedX: root.leftMargin
1463 windowedX: root.leftMargin
1354− windowedY: PanelState.panelHeight
1464+ windowedY: panelState.panelHeight
1355 windowedWidth: (appContainer.width - root.leftMargin)/2
1465 windowedWidth: (appContainer.width - root.leftMargin)/2
1356− windowedHeight: appContainer.height - PanelState.panelHeight
1466+ windowedHeight: appContainer.height - panelState.panelHeight
@@ -1370,9 +1480,9 @@ FocusScope {
1370 PropertyChanges {
1480 PropertyChanges {
1371 target: appDelegate
1481 target: appDelegate
1372 windowedX: root.leftMargin
1482 windowedX: root.leftMargin
1373− windowedY: PanelState.panelHeight
1483+ windowedY: panelState.panelHeight
1374 windowedWidth: (appContainer.width - root.leftMargin)/2
1484 windowedWidth: (appContainer.width - root.leftMargin)/2
1375− windowedHeight: (appContainer.height - PanelState.panelHeight)/2
1485+ windowedHeight: (appContainer.height - panelState.panelHeight)/2
@@ -1389,7 +1499,7 @@ FocusScope {
1389 PropertyChanges {
1499 PropertyChanges {
1390 target: appDelegate
1500 target: appDelegate
1391 windowedX: root.leftMargin
1501 windowedX: root.leftMargin
1392− windowedY: (appContainer.height + PanelState.panelHeight)/2
1502+ windowedY: (appContainer.height + panelState.panelHeight)/2
1393 windowedWidth: (appContainer.width - root.leftMargin)/2
1503 windowedWidth: (appContainer.width - root.leftMargin)/2
1394 windowedHeight: appContainer.height/2
1504 windowedHeight: appContainer.height/2
@@ -1411,8 +1521,8 @@ FocusScope {
1412 name: "maximizedVertically"; when: appDelegate.maximizedVertically && !appDelegate.minimized
1522 name: "maximizedVertically"; when: appDelegate.maximizedVertically && !appDelegate.minimized
1413 extend: "normal"
1523 extend: "normal"
1414− PropertyChanges { target: appDelegate; windowedX: windowedX; windowedY: PanelState.panelHeight;
1524+ PropertyChanges { target: appDelegate; windowedX: windowedX; windowedY: panelState.panelHeight;
1415− windowedWidth: windowedWidth; windowedHeight: appContainer.height - PanelState.panelHeight }
1525+ windowedWidth: windowedWidth; windowedHeight: appContainer.height - panelState.panelHeight }
1418 name: "minimized"; when: appDelegate.minimized
1528 name: "minimized"; when: appDelegate.minimized
@@ -1511,7 +1621,7 @@ FocusScope {
1513 Binding {
1623 Binding {
1514− target: PanelState
1624+ target: panelState
1515 property: "decorationsAlwaysVisible"
1625 property: "decorationsAlwaysVisible"
1516 value: appDelegate && appDelegate.maximized && touchControls.overlayShown
1626 value: appDelegate && appDelegate.maximized && touchControls.overlayShown
@@ -1754,6 +1864,7 @@ FocusScope {
1754 leftMargin: root.leftMargin
1864 leftMargin: root.leftMargin
1755 appContainerWidth: appContainer.width
1865 appContainerWidth: appContainer.width
1756 appContainerHeight: appContainer.height
1866 appContainerHeight: appContainer.height
1867+ panelState: root.panelState
1759 EdgeBarrier {
1870 EdgeBarrier {
@@ -1780,83 +1891,6 @@ FocusScope {
1785− objectName: "hoverMouseArea"
1786− anchors.fill: appContainer
1787− propagateComposedEvents: true
1792− property int scrollAreaWidth: width / 3
1793− property bool progressiveScrollingEnabled: false
1796− mouse.accepted = false
1798− if (hoverMouseArea.pressed) {
1802− // Find the hovered item and mark it active
1803− for (var i = appRepeater.count - 1; i >= 0; i--) {
1804− var appDelegate = appRepeater.itemAt(i);
1805− var mapped = mapToItem(appDelegate, hoverMouseArea.mouseX, hoverMouseArea.mouseY)
1806− var itemUnder = appDelegate.childAt(mapped.x, mapped.y);
1807− if (itemUnder && (itemUnder.objectName === "dragArea" || itemUnder.objectName === "windowInfoItem" || itemUnder.objectName == "closeMouseArea")) {
1808− spreadItem.highlightedIndex = i;
1813− if (floatingFlickable.contentWidth > floatingFlickable.width) {
1814− var margins = floatingFlickable.width * 0.05;
1816− if (!progressiveScrollingEnabled && mouseX < floatingFlickable.width - scrollAreaWidth) {
1817− progressiveScrollingEnabled = true
1820− // do we need to scroll?
1821− if (mouseX < scrollAreaWidth + margins) {
1822− var progress = Math.min(1, (scrollAreaWidth + margins - mouseX) / (scrollAreaWidth - margins));
1823− var contentX = (1 - progress) * (floatingFlickable.contentWidth - floatingFlickable.width)
1824− floatingFlickable.contentX = Math.max(0, Math.min(floatingFlickable.contentX, contentX))
1826− if (mouseX > floatingFlickable.width - scrollAreaWidth && progressiveScrollingEnabled) {
1827− var progress = Math.min(1, (mouseX - (floatingFlickable.width - scrollAreaWidth)) / (scrollAreaWidth - margins))
1828− var contentX = progress * (floatingFlickable.contentWidth - floatingFlickable.width)
1829− floatingFlickable.contentX = Math.min(floatingFlickable.contentWidth - floatingFlickable.width, Math.max(floatingFlickable.contentX, contentX))
1834− onPressed: mouse.accepted = false
1837− FloatingFlickable {
1838− id: floatingFlickable
1839− objectName: "spreadFlickable"
1840− anchors.fill: appContainer
1842− contentWidth: spreadItem.spreadTotalWidth
1844− function snap(toIndex) {
1845− var delegate = appRepeater.itemAt(toIndex)
1846− var targetContentX = floatingFlickable.contentWidth / spreadItem.totalItemCount * toIndex;
1847− if (targetContentX - floatingFlickable.contentX > spreadItem.rightStackXPos - (spreadItem.spreadItemWidth / 2)) {
1848− var offset = (spreadItem.rightStackXPos - (spreadItem.spreadItemWidth / 2)) - (targetContentX - floatingFlickable.contentX)
1849− snapAnimation.to = floatingFlickable.contentX - offset;
1850− snapAnimation.start();
1851− } else if (targetContentX - floatingFlickable.contentX < spreadItem.leftStackXPos + units.gu(1)) {
1852− var offset = (spreadItem.leftStackXPos + units.gu(1)) - (targetContentX - floatingFlickable.contentX);
1853− snapAnimation.to = floatingFlickable.contentX - offset;
1854− snapAnimation.start();
1857− UbuntuNumberAnimation {id: snapAnimation; target: floatingFlickable; property: "contentX"}
1860 PropertyAnimation {
1894 PropertyAnimation {
1861 id: shortRightEdgeSwipeAnimation
1895 id: shortRightEdgeSwipeAnimation
1862 property: "x"
1896 property: "x"