@@ -48,6 +48,9 @@ FocusScope {
48 property rect inputMethodRect
48 property rect inputMethodRect
49 property real rightEdgePushProgress: 0
49 property real rightEdgePushProgress: 0
50 property Item availableDesktopArea
50 property Item availableDesktopArea
51+ property PanelState panelState
53+ readonly property var temporarySelectedWorkspace: state == "spread" ? screensAndWorkspaces.activeWorkspace : null
52 // Configuration
55 // Configuration
53 property string mode: "staged"
56 property string mode: "staged"
@@ -154,6 +157,7 @@ FocusScope {
154 function updateFocusedAppOrientationAnimated() { /* TODO */}
157 function updateFocusedAppOrientationAnimated() { /* TODO */}
156 function closeSpread() {
159 function closeSpread() {
160+ spreadItem.highlightedIndex = -1;
157 priv.goneToSpread = false;
161 priv.goneToSpread = false;
@@ -260,6 +264,43 @@ FocusScope {
268+ id: showWorkspaceSwitcherShortcutLeft
269+ shortcut: Qt.AltModifier|Qt.ControlModifier|Qt.Key_Left
270+ active: !workspaceSwitcher.active
273+ workspaceSwitcher.showLeft()
277+ id: showWorkspaceSwitcherShortcutRight
278+ shortcut: Qt.AltModifier|Qt.ControlModifier|Qt.Key_Right
279+ active: !workspaceSwitcher.active
282+ workspaceSwitcher.showRight()
286+ id: showWorkspaceSwitcherShortcutUp
287+ shortcut: Qt.AltModifier|Qt.ControlModifier|Qt.Key_Up
288+ active: !workspaceSwitcher.active
291+ workspaceSwitcher.showUp()
295+ id: showWorkspaceSwitcherShortcutDown
296+ shortcut: Qt.AltModifier|Qt.ControlModifier|Qt.Key_Down
297+ active: !workspaceSwitcher.active
300+ workspaceSwitcher.showDown()
263 QtObject {
304 QtObject {
265 objectName: "DesktopStagePrivate"
306 objectName: "DesktopStagePrivate"
@@ -395,23 +436,23 @@ FocusScope {
395 readonly property real windowDecorationHeight: units.gu(3)
436 readonly property real windowDecorationHeight: units.gu(3)
398− Component.onCompleted: priv.updateMainAndSideStageIndexes();
439+ Component.onCompleted: priv.updateMainAndSideStageIndexes()
400 Connections {
441 Connections {
401− target: PanelState
442+ target: panelState
402 onCloseClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.close(); } }
443 onCloseClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.close(); } }
403 onMinimizeClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.requestMinimize(); } }
444 onMinimizeClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.requestMinimize(); } }
404 onRestoreClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.requestRestore(); } }
445 onRestoreClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.requestRestore(); } }
407 Binding {
448 Binding {
408− target: PanelState
449+ target: panelState
409 property: "decorationsVisible"
450 property: "decorationsVisible"
410 value: mode == "windowed" && priv.focusedAppDelegate && priv.focusedAppDelegate.maximized && !root.spreadShown
451 value: mode == "windowed" && priv.focusedAppDelegate && priv.focusedAppDelegate.maximized && !root.spreadShown
413 Binding {
454 Binding {
414− target: PanelState
455+ target: panelState
415 property: "title"
456 property: "title"
417 if (priv.focusedAppDelegate !== null) {
458 if (priv.focusedAppDelegate !== null) {
@@ -426,7 +467,7 @@ FocusScope {
428 Binding {
469 Binding {
429− target: PanelState
470+ target: panelState
430 property: "focusedPersistentSurfaceId"
471 property: "focusedPersistentSurfaceId"
432 if (priv.focusedAppDelegate !== null) {
473 if (priv.focusedAppDelegate !== null) {
@@ -440,21 +481,21 @@ FocusScope {
442 Binding {
483 Binding {
443− target: PanelState
484+ target: panelState
444 property: "dropShadow"
485 property: "dropShadow"
445 value: priv.focusedAppDelegate && !priv.focusedAppDelegate.maximized && priv.foregroundMaximizedAppDelegate !== null && mode == "windowed"
486 value: priv.focusedAppDelegate && !priv.focusedAppDelegate.maximized && priv.foregroundMaximizedAppDelegate !== null && mode == "windowed"
448 Binding {
489 Binding {
449− target: PanelState
490+ target: panelState
450 property: "closeButtonShown"
491 property: "closeButtonShown"
451 value: priv.focusedAppDelegate && priv.focusedAppDelegate.maximized
492 value: priv.focusedAppDelegate && priv.focusedAppDelegate.maximized
454 Component.onDestruction: {
495 Component.onDestruction: {
455− PanelState.title = "";
496+ panelState.title = "";
456− PanelState.decorationsVisible = false;
497+ panelState.decorationsVisible = false;
457− PanelState.dropShadow = false;
498+ panelState.dropShadow = false;
460 Instantiator {
501 Instantiator {
@@ -500,6 +541,7 @@ FocusScope {
500 PropertyChanges { target: noAppsRunningHint; visible: (root.topLevelSurfaceList.count < 1) }
541 PropertyChanges { target: noAppsRunningHint; visible: (root.topLevelSurfaceList.count < 1) }
501 PropertyChanges { target: blurLayer; visible: true; blurRadius: 32; brightness: .65; opacity: 1 }
542 PropertyChanges { target: blurLayer; visible: true; blurRadius: 32; brightness: .65; opacity: 1 }
502 PropertyChanges { target: wallpaper; visible: false }
543 PropertyChanges { target: wallpaper; visible: false }
544+ PropertyChanges { target: screensAndWorkspaces; opacity: 1 }
505 name: "stagedRightEdge"; when: root.spreadEnabled && (rightEdgeDragArea.dragging || rightEdgePushProgress > 0) && root.mode == "staged"
547 name: "stagedRightEdge"; when: root.spreadEnabled && (rightEdgeDragArea.dragging || rightEdgePushProgress > 0) && root.mode == "staged"
@@ -554,11 +596,16 @@ FocusScope {
554 Transition {
596 Transition {
555 from: "stagedRightEdge,sideStagedRightEdge,windowedRightEdge"; to: "spread"
597 from: "stagedRightEdge,sideStagedRightEdge,windowedRightEdge"; to: "spread"
556 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: -1 }
598 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: -1 }
599+ PropertyAction { target: screensAndWorkspaces; property: "activeWorkspace"; value: WMScreen.currentWorkspace }
557 PropertyAnimation { target: blurLayer; properties: "brightness,blurRadius"; duration: priv.animationDuration }
600 PropertyAnimation { target: blurLayer; properties: "brightness,blurRadius"; duration: priv.animationDuration }
601+ UbuntuNumberAnimation { target: screensAndWorkspaces; property: "opacity"; duration: priv.animationDuration }
559 Transition {
603 Transition {
560 to: "spread"
604 to: "spread"
605+ PropertyAction { target: screensAndWorkspaces; property: "activeWorkspace"; value: WMScreen.currentWorkspace }
561 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: appRepeater.count > 1 ? 1 : 0 }
606 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: appRepeater.count > 1 ? 1 : 0 }
607+ PropertyAction { target: floatingFlickable; property: "contentX"; value: 0 }
608+ UbuntuNumberAnimation { target: screensAndWorkspaces; property: "opacity"; duration: priv.animationDuration }
563 Transition {
610 Transition {
564 from: "spread"
611 from: "spread"
@@ -616,10 +663,20 @@ FocusScope {
616 visible: false
663 visible: false
666+ ScreensAndWorkspaces {
667+ id: screensAndWorkspaces
668+ anchors { left: parent.left; top: parent.top; right: parent.right; leftMargin: root.leftMargin }
669+ height: Math.max(units.gu(30), parent.height * .3)
670+ background: root.background
672+ visible: opacity > 0
673+ onCloseSpread: priv.goneToSpread = false;
620 id: spreadItem
677 id: spreadItem
621 objectName: "spreadItem"
678 objectName: "spreadItem"
622− anchors.fill: appContainer
679+ anchors { left: parent.left; bottom: parent.bottom; right: parent.right; top: screensAndWorkspaces.bottom }
623 leftMargin: root.availableDesktopArea.x
680 leftMargin: root.availableDesktopArea.x
624 model: root.topLevelSurfaceList
681 model: root.topLevelSurfaceList
625 spreadFlickable: floatingFlickable
682 spreadFlickable: floatingFlickable
@@ -632,6 +689,89 @@ FocusScope {
632 onCloseCurrentApp: {
689 onCloseCurrentApp: {
633 appRepeater.itemAt(highlightedIndex).close();
690 appRepeater.itemAt(highlightedIndex).close();
694+ id: floatingFlickable
695+ objectName: "spreadFlickable"
696+ anchors.fill: parent
698+ contentWidth: spreadItem.spreadTotalWidth
700+ function snap(toIndex) {
701+ var delegate = appRepeater.itemAt(toIndex)
702+ var targetContentX = floatingFlickable.contentWidth / spreadItem.totalItemCount * toIndex;
703+ if (targetContentX - floatingFlickable.contentX > spreadItem.rightStackXPos - (spreadItem.spreadItemWidth / 2)) {
704+ var offset = (spreadItem.rightStackXPos - (spreadItem.spreadItemWidth / 2)) - (targetContentX - floatingFlickable.contentX)
705+ snapAnimation.to = floatingFlickable.contentX - offset;
706+ snapAnimation.start();
707+ } else if (targetContentX - floatingFlickable.contentX < spreadItem.leftStackXPos + units.gu(1)) {
708+ var offset = (spreadItem.leftStackXPos + units.gu(1)) - (targetContentX - floatingFlickable.contentX);
709+ snapAnimation.to = floatingFlickable.contentX - offset;
710+ snapAnimation.start();
713+ UbuntuNumberAnimation {id: snapAnimation; target: floatingFlickable; property: "contentX"}
718+ objectName: "hoverMouseArea"
719+ anchors.fill: parent
720+ propagateComposedEvents: true
724+ property bool wasTouchPress: false
726+ property int scrollAreaWidth: width / 3
727+ property bool progressiveScrollingEnabled: false
730+ mouse.accepted = false
732+ if (hoverMouseArea.pressed || wasTouchPress) {
736+ // Find the hovered item and mark it active
737+ for (var i = appRepeater.count - 1; i >= 0; i--) {
738+ var appDelegate = appRepeater.itemAt(i);
739+ var mapped = mapToItem(appDelegate, hoverMouseArea.mouseX, hoverMouseArea.mouseY)
740+ var itemUnder = appDelegate.childAt(mapped.x, mapped.y);
741+ if (itemUnder && (itemUnder.objectName === "dragArea" || itemUnder.objectName === "windowInfoItem" || itemUnder.objectName == "closeMouseArea")) {
742+ spreadItem.highlightedIndex = i;
747+ if (floatingFlickable.contentWidth > floatingFlickable.width) {
748+ var margins = floatingFlickable.width * 0.05;
750+ if (!progressiveScrollingEnabled && mouseX < floatingFlickable.width - scrollAreaWidth) {
751+ progressiveScrollingEnabled = true
754+ // do we need to scroll?
755+ if (mouseX < scrollAreaWidth + margins) {
756+ var progress = Math.min(1, (scrollAreaWidth + margins - mouseX) / (scrollAreaWidth - margins));
757+ var contentX = (1 - progress) * (floatingFlickable.contentWidth - floatingFlickable.width)
758+ floatingFlickable.contentX = Math.max(0, Math.min(floatingFlickable.contentX, contentX))
760+ if (mouseX > floatingFlickable.width - scrollAreaWidth && progressiveScrollingEnabled) {
761+ var progress = Math.min(1, (mouseX - (floatingFlickable.width - scrollAreaWidth)) / (scrollAreaWidth - margins))
762+ var contentX = progress * (floatingFlickable.contentWidth - floatingFlickable.width)
763+ floatingFlickable.contentX = Math.min(floatingFlickable.contentWidth - floatingFlickable.width, Math.max(floatingFlickable.contentX, contentX))
769+ mouse.accepted = false;
770+ wasTouchPress = mouse.source === Qt.MouseEventSynthesizedByQt;
773+ onExited: wasTouchPress = false;
@@ -739,6 +879,24 @@ FocusScope {
884+ property real previewScale: .5
885+ height: (screensAndWorkspaces.height - units.gu(8)) / 2
887+ width: implicitWidth * height / implicitHeight
890+ opacity: surface != null ? 1 : 0
891+ Behavior on opacity { UbuntuNumberAnimation {} }
892+ visible: opacity > 0
894+ Drag.active: surface != null
895+ Drag.keys: ["application"]
742 Repeater {
900 Repeater {
743 id: appRepeater
901 id: appRepeater
744 model: topLevelSurfaceList
902 model: topLevelSurfaceList
@@ -767,6 +925,9 @@ FocusScope {
768 z: normalZ
926 z: normalZ
928+ opacity: fakeDragItem.surface == model.window.surface && fakeDragItem.Drag.active ? 0 : 1
929+ Behavior on opacity { UbuntuNumberAnimation {} }
770 // Normally we want x/y where the surface thinks it is. Width/height of our delegate will
931 // Normally we want x/y where the surface thinks it is. Width/height of our delegate will
771 // match what the actual surface size is.
932 // match what the actual surface size is.
772 // Don't write to those, they will be set by states
933 // Don't write to those, they will be set by states
@@ -946,7 +1107,6 @@ FocusScope {
946 function claimFocus() {
1107 function claimFocus() {
947 if (root.state == "spread") {
1108 if (root.state == "spread") {
948 spreadItem.highlightedIndex = index
1109 spreadItem.highlightedIndex = index
949− priv.goneToSpread = false;
951 if (root.mode == "stagedWithSideStage") {
1111 if (root.mode == "stagedWithSideStage") {
952 if (appDelegate.stage == ApplicationInfoInterface.SideStage && !sideStage.shown) {
1112 if (appDelegate.stage == ApplicationInfoInterface.SideStage && !sideStage.shown) {
@@ -1280,8 +1440,6 @@ FocusScope {
1280 y: spreadMaths.targetY
1440 y: spreadMaths.targetY
1281 z: index
1441 z: index
1282 height: spreadItem.spreadItemHeight
1442 height: spreadItem.spreadItemHeight
1283− requestedWidth: decoratedWindow.oldRequestedWidth
1284− requestedHeight: decoratedWindow.oldRequestedHeight
1285 visible: spreadMaths.itemVisible
1443 visible: spreadMaths.itemVisible
1287 PropertyChanges { target: dragArea; enabled: true }
1445 PropertyChanges { target: dragArea; enabled: true }
@@ -1301,8 +1459,6 @@ FocusScope {
1301 y: stagedRightEdgeMaths.animatedY
1459 y: stagedRightEdgeMaths.animatedY
1302 z: stagedRightEdgeMaths.animatedZ
1460 z: stagedRightEdgeMaths.animatedZ
1303 height: stagedRightEdgeMaths.animatedHeight
1461 height: stagedRightEdgeMaths.animatedHeight
1304− requestedWidth: decoratedWindow.oldRequestedWidth
1305− requestedHeight: decoratedWindow.oldRequestedHeight
1306 visible: appDelegate.x < root.width
1462 visible: appDelegate.x < root.width
1308 PropertyChanges {
1464 PropertyChanges {
@@ -1332,8 +1488,6 @@ FocusScope {
1332 y: windowedRightEdgeMaths.animatedY
1488 y: windowedRightEdgeMaths.animatedY
1333 z: windowedRightEdgeMaths.animatedZ
1489 z: windowedRightEdgeMaths.animatedZ
1334 height: stagedRightEdgeMaths.animatedHeight
1490 height: stagedRightEdgeMaths.animatedHeight
1335− requestedWidth: decoratedWindow.oldRequestedWidth
1336− requestedHeight: decoratedWindow.oldRequestedHeight
1338 PropertyChanges {
1492 PropertyChanges {
1339 target: decoratedWindow
1493 target: decoratedWindow
@@ -1356,11 +1510,15 @@ FocusScope {
1356 target: appDelegate
1510 target: appDelegate
1357 x: stageMaths.itemX
1511 x: stageMaths.itemX
1358 y: root.availableDesktopArea.y
1512 y: root.availableDesktopArea.y
1359− requestedWidth: appContainer.width
1360− requestedHeight: root.availableDesktopArea.height
1361 visuallyMaximized: true
1513 visuallyMaximized: true
1362 visible: appDelegate.x < root.width
1514 visible: appDelegate.x < root.width
1517+ target: appDelegate
1518+ requestedWidth: appContainer.width
1519+ requestedHeight: root.availableDesktopArea.height
1520+ restoreEntryValues: false
1364 PropertyChanges {
1522 PropertyChanges {
1365 target: decoratedWindow
1523 target: decoratedWindow
1366 hasDecoration: false
1524 hasDecoration: false
@@ -1389,11 +1547,15 @@ FocusScope {
1389 x: stageMaths.itemX
1547 x: stageMaths.itemX
1390 y: root.availableDesktopArea.y
1548 y: root.availableDesktopArea.y
1391 z: stageMaths.itemZ
1549 z: stageMaths.itemZ
1392− requestedWidth: stageMaths.itemWidth
1393− requestedHeight: root.availableDesktopArea.height
1394 visuallyMaximized: true
1550 visuallyMaximized: true
1395 visible: appDelegate.x < root.width
1551 visible: appDelegate.x < root.width
1554+ target: appDelegate
1555+ requestedWidth: stageMaths.itemWidth
1556+ requestedHeight: root.availableDesktopArea.height
1557+ restoreEntryValues: false
1397 PropertyChanges {
1559 PropertyChanges {
1398 target: decoratedWindow
1560 target: decoratedWindow
1399 hasDecoration: false
1561 hasDecoration: false
@@ -1414,8 +1576,13 @@ FocusScope {
1414 requestedX: root.availableDesktopArea.x;
1576 requestedX: root.availableDesktopArea.x;
1415 requestedY: 0;
1577 requestedY: 0;
1416 visuallyMinimized: false;
1578 visuallyMinimized: false;
1579+ visuallyMaximized: true
1582+ target: appDelegate
1417 requestedWidth: root.availableDesktopArea.width;
1583 requestedWidth: root.availableDesktopArea.width;
1418 requestedHeight: appContainer.height;
1584 requestedHeight: appContainer.height;
1585+ restoreEntryValues: false
1420 PropertyChanges { target: touchControls; enabled: true }
1587 PropertyChanges { target: touchControls; enabled: true }
1421 PropertyChanges { target: decoratedWindow; windowControlButtonsVisible: false }
1588 PropertyChanges { target: decoratedWindow; windowControlButtonsVisible: false }
@@ -1426,8 +1593,12 @@ FocusScope {
1426 target: appDelegate;
1593 target: appDelegate;
1427 requestedX: 0
1594 requestedX: 0
1428 requestedY: 0
1595 requestedY: 0
1598+ target: appDelegate
1429− requestedWidth: appContainer.width;
1599+ requestedWidth: appContainer.width
1430− requestedHeight: appContainer.height;
1600+ requestedHeight: appContainer.height
1601+ restoreEntryValues: false
1432 PropertyChanges { target: decoratedWindow; hasDecoration: false }
1603 PropertyChanges { target: decoratedWindow; hasDecoration: false }
@@ -1441,6 +1612,12 @@ FocusScope {
1441 PropertyChanges { target: touchControls; enabled: true }
1612 PropertyChanges { target: touchControls; enabled: true }
1442 PropertyChanges { target: resizeArea; enabled: true }
1613 PropertyChanges { target: resizeArea; enabled: true }
1443 PropertyChanges { target: decoratedWindow; shadowOpacity: .3; windowControlButtonsVisible: true}
1614 PropertyChanges { target: decoratedWindow; shadowOpacity: .3; windowControlButtonsVisible: true}
1616+ target: appDelegate
1617+ requestedWidth: windowedWidth
1618+ requestedHeight: windowedHeight
1619+ restoreEntryValues: false
1446 name: "restored";
1623 name: "restored";
@@ -1541,6 +1718,7 @@ FocusScope {
1544 transitions: [
1722 transitions: [
1545 Transition {
1723 Transition {
1546 from: "staged,stagedWithSideStage"
1724 from: "staged,stagedWithSideStage"
@@ -1554,6 +1732,7 @@ FocusScope {
1554 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,requestedX,requestedY,requestedWidth,requestedHeight"; duration: priv.animationDuration}
1732 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,requestedX,requestedY,requestedWidth,requestedHeight"; duration: priv.animationDuration}
1556 Transition {
1734 Transition {
1735+ from: "normal,restored,maximized,maximizedHorizontally,maximizedVertically,maximizedLeft,maximizedRight,maximizedTopLeft,maximizedBottomLeft,maximizedTopRight,maximizedBottomRight,staged,stagedWithSideStage,windowedRightEdge,stagedRightEdge";
1557 to: "spread"
1736 to: "spread"
1558 // DecoratedWindow wants the scaleToPreviewSize set before enabling scaleToPreview
1737 // DecoratedWindow wants the scaleToPreviewSize set before enabling scaleToPreview
1559 PropertyAction { target: appDelegate; properties: "z,visible" }
1738 PropertyAction { target: appDelegate; properties: "z,visible" }
@@ -1646,7 +1825,7 @@ FocusScope {
1648 Binding {
1827 Binding {
1649− target: PanelState
1828+ target: panelState
1650 property: "decorationsAlwaysVisible"
1829 property: "decorationsAlwaysVisible"
1651 value: appDelegate && appDelegate.maximized && touchControls.overlayShown
1830 value: appDelegate && appDelegate.maximized && touchControls.overlayShown
@@ -1667,6 +1846,7 @@ FocusScope {
1667 borderThickness: units.gu(2)
1846 borderThickness: units.gu(2)
1668 enabled: false
1847 enabled: false
1669 visible: enabled
1848 visible: enabled
1849+ readyToAssesBounds: !appDelegate._constructing
1671 onPressed: {
1851 onPressed: {
1672 appDelegate.activate();
1852 appDelegate.activate();
@@ -1690,18 +1870,13 @@ FocusScope {
1690 width: implicitWidth
1870 width: implicitWidth
1691 height: implicitHeight
1871 height: implicitHeight
1692 highlightSize: windowInfoItem.iconMargin / 2
1872 highlightSize: windowInfoItem.iconMargin / 2
1693− altDragEnabled: root.mode == "windowed"
1694 boundsItem: root.availableDesktopArea
1873 boundsItem: root.availableDesktopArea
1874+ panelState: root.panelState
1875+ altDragEnabled: root.mode == "windowed"
1696 requestedWidth: appDelegate.requestedWidth
1877 requestedWidth: appDelegate.requestedWidth
1697 requestedHeight: appDelegate.requestedHeight
1878 requestedHeight: appDelegate.requestedHeight
1699− property int oldRequestedWidth: -1
1700− property int oldRequestedHeight: -1
1702− onRequestedWidthChanged: oldRequestedWidth = requestedWidth
1703− onRequestedHeightChanged: oldRequestedHeight = requestedHeight
1705 onCloseClicked: { appDelegate.close(); }
1880 onCloseClicked: { appDelegate.close(); }
1706 onMaximizeClicked: {
1881 onMaximizeClicked: {
1707 if (appDelegate.canBeMaximized) {
1882 if (appDelegate.canBeMaximized) {
@@ -1782,6 +1957,8 @@ FocusScope {
1782 anchors.fill: decoratedWindow
1957 anchors.fill: decoratedWindow
1783 enabled: false
1958 enabled: false
1784 closeable: true
1959 closeable: true
1961+ dragDelegate: fakeDragItem
1786 onClicked: {
1963 onClicked: {
1787 spreadItem.highlightedIndex = index;
1964 spreadItem.highlightedIndex = index;
@@ -1824,12 +2001,15 @@ FocusScope {
1824 objectName: "closeMouseArea"
2001 objectName: "closeMouseArea"
1825 anchors { left: parent.left; top: parent.top; leftMargin: -height / 2; topMargin: -height / 2 + spreadMaths.closeIconOffset }
2002 anchors { left: parent.left; top: parent.top; leftMargin: -height / 2; topMargin: -height / 2 + spreadMaths.closeIconOffset }
1826 readonly property var mousePos: hoverMouseArea.mapToItem(appDelegate, hoverMouseArea.mouseX, hoverMouseArea.mouseY)
2003 readonly property var mousePos: hoverMouseArea.mapToItem(appDelegate, hoverMouseArea.mouseX, hoverMouseArea.mouseY)
1827− visible: dragArea.distance == 0
2004+ readonly property bool shown: dragArea.distance == 0
1828 && index == spreadItem.highlightedIndex
2005 && index == spreadItem.highlightedIndex
1829 && mousePos.y < (decoratedWindow.height / 3)
2006 && mousePos.y < (decoratedWindow.height / 3)
1830 && mousePos.y > -units.gu(4)
2007 && mousePos.y > -units.gu(4)
1831 && mousePos.x > -units.gu(4)
2008 && mousePos.x > -units.gu(4)
1832 && mousePos.x < (decoratedWindow.width * 2 / 3)
2009 && mousePos.x < (decoratedWindow.width * 2 / 3)
2010+ opacity: shown ? 1 : 0
2011+ visible: opacity > 0
2012+ Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
1833 height: units.gu(6)
2013 height: units.gu(6)
1834 width: height
2014 width: height
@@ -1900,89 +2080,20 @@ FocusScope {
1900 leftMargin: root.availableDesktopArea.x
2080 leftMargin: root.availableDesktopArea.x
1901 appContainerWidth: appContainer.width
2081 appContainerWidth: appContainer.width
1902 appContainerHeight: appContainer.height
2082 appContainerHeight: appContainer.height
2083+ panelState: root.panelState
1905− MouseArea {
2086+ WorkspaceSwitcher {
1906− id: hoverMouseArea
2087+ id: workspaceSwitcher
1907− objectName: "hoverMouseArea"
2088+ anchors.centerIn: parent
1908− anchors.fill: appContainer
2089+ height: units.gu(20)
1909− propagateComposedEvents: true
2090+ width: root.width - units.gu(8)
1910− hoverEnabled: true
2091+ background: root.background
1911− enabled: false
2092+ onActiveChanged: {
1912− visible: enabled
2093+ if (!active) {
1913−
2094+ appContainer.focus = true;
1914− property int scrollAreaWidth: width / 3
1915− property bool progressiveScrollingEnabled: false
1916− property bool wasTouchPress: false
1919− mouse.accepted = false
1921− if (hoverMouseArea.pressed || wasTouchPress) {
1925− // Find the hovered item and mark it active
1926− for (var i = appRepeater.count - 1; i >= 0; i--) {
1927− var appDelegate = appRepeater.itemAt(i);
1928− var mapped = mapToItem(appDelegate, hoverMouseArea.mouseX, hoverMouseArea.mouseY)
1929− var itemUnder = appDelegate.childAt(mapped.x, mapped.y);
1930− if (itemUnder && (itemUnder.objectName === "dragArea" || itemUnder.objectName === "windowInfoItem" || itemUnder.objectName == "closeMouseArea")) {
1931− spreadItem.highlightedIndex = i;
1936− if (floatingFlickable.contentWidth > floatingFlickable.width) {
1937− var margins = floatingFlickable.width * 0.05;
1939− if (!progressiveScrollingEnabled && mouseX < floatingFlickable.width - scrollAreaWidth) {
1940− progressiveScrollingEnabled = true
1943− // do we need to scroll?
1944− if (mouseX < scrollAreaWidth + margins) {
1945− var progress = Math.min(1, (scrollAreaWidth + margins - mouseX) / (scrollAreaWidth - margins));
1946− var contentX = (1 - progress) * (floatingFlickable.contentWidth - floatingFlickable.width)
1947− floatingFlickable.contentX = Math.max(0, Math.min(floatingFlickable.contentX, contentX))
1949− if (mouseX > floatingFlickable.width - scrollAreaWidth && progressiveScrollingEnabled) {
1950− var progress = Math.min(1, (mouseX - (floatingFlickable.width - scrollAreaWidth)) / (scrollAreaWidth - margins))
1951− var contentX = progress * (floatingFlickable.contentWidth - floatingFlickable.width)
1952− floatingFlickable.contentX = Math.min(floatingFlickable.contentWidth - floatingFlickable.width, Math.max(floatingFlickable.contentX, contentX))
1958− mouse.accepted = false;
1959− wasTouchPress = mouse.source === Qt.MouseEventSynthesizedByQt;
1962− onExited: wasTouchPress = false;
1965− FloatingFlickable {
1966− id: floatingFlickable
1967− objectName: "spreadFlickable"
1968− anchors.fill: appContainer
1970− contentWidth: spreadItem.spreadTotalWidth
1972− function snap(toIndex) {
1973− var delegate = appRepeater.itemAt(toIndex)
1974− var targetContentX = floatingFlickable.contentWidth / spreadItem.totalItemCount * toIndex;
1975− if (targetContentX - floatingFlickable.contentX > spreadItem.rightStackXPos - (spreadItem.spreadItemWidth / 2)) {
1976− var offset = (spreadItem.rightStackXPos - (spreadItem.spreadItemWidth / 2)) - (targetContentX - floatingFlickable.contentX)
1977− snapAnimation.to = Math.max(0, floatingFlickable.contentX - offset);
1978− snapAnimation.start();
1979− } else if (targetContentX - floatingFlickable.contentX < spreadItem.leftStackXPos + units.gu(1)) {
1980− var offset = (spreadItem.leftStackXPos + units.gu(1)) - (targetContentX - floatingFlickable.contentX);
1981− snapAnimation.to = Math.max(0, floatingFlickable.contentX - offset);
1982− snapAnimation.start();
1985− UbuntuNumberAnimation {id: snapAnimation; target: floatingFlickable; property: "contentX"}
1988 PropertyAnimation {
2099 PropertyAnimation {