@@ -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.lastClickedWorkspace : null
52 // Configuration
55 // Configuration
53 property string mode: "staged"
56 property string mode: "staged"
@@ -137,6 +140,7 @@ FocusScope {
137 function updateFocusedAppOrientationAnimated() { /* TODO */}
140 function updateFocusedAppOrientationAnimated() { /* TODO */}
139 function closeSpread() {
142 function closeSpread() {
143+ spreadItem.highlightedIndex = -1;
140 priv.goneToSpread = false;
144 priv.goneToSpread = false;
@@ -243,6 +247,25 @@ FocusScope {
251+ id: showWorkspaceSwitcherShortcutLeft
252+ shortcut: Qt.AltModifier|Qt.ControlModifier|Qt.Key_Left
253+ active: !workspaceSwitcher.active
256+ workspaceSwitcher.showLeft()
260+ id: showWorkspaceSwitcherShortcutRight
261+ shortcut: Qt.AltModifier|Qt.ControlModifier|Qt.Key_Right
262+ active: !workspaceSwitcher.active
265+ workspaceSwitcher.showRight()
246 QtObject {
269 QtObject {
248 objectName: "DesktopStagePrivate"
271 objectName: "DesktopStagePrivate"
@@ -378,23 +401,23 @@ FocusScope {
378 readonly property real windowDecorationHeight: units.gu(3)
401 readonly property real windowDecorationHeight: units.gu(3)
381− Component.onCompleted: priv.updateMainAndSideStageIndexes();
404+ Component.onCompleted: priv.updateMainAndSideStageIndexes()
383 Connections {
406 Connections {
384− target: PanelState
407+ target: panelState
385 onCloseClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.close(); } }
408 onCloseClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.close(); } }
386 onMinimizeClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.requestMinimize(); } }
409 onMinimizeClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.requestMinimize(); } }
387 onRestoreClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.requestRestore(); } }
410 onRestoreClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.requestRestore(); } }
390 Binding {
413 Binding {
391− target: PanelState
414+ target: panelState
392 property: "decorationsVisible"
415 property: "decorationsVisible"
393 value: priv.focusedAppDelegate !== null && priv.focusedAppDelegate.maximized // FIXME for Locally integrated menus
416 value: priv.focusedAppDelegate !== null && priv.focusedAppDelegate.maximized // FIXME for Locally integrated menus
396 Binding {
419 Binding {
397− target: PanelState
420+ target: panelState
398 property: "title"
421 property: "title"
400 if (priv.focusedAppDelegate !== null) {
423 if (priv.focusedAppDelegate !== null) {
@@ -409,7 +432,7 @@ FocusScope {
411 Binding {
434 Binding {
412− target: PanelState
435+ target: panelState
413 property: "focusedPersistentSurfaceId"
436 property: "focusedPersistentSurfaceId"
415 if (priv.focusedAppDelegate !== null) {
438 if (priv.focusedAppDelegate !== null) {
@@ -423,21 +446,21 @@ FocusScope {
425 Binding {
448 Binding {
426− target: PanelState
449+ target: panelState
427 property: "dropShadow"
450 property: "dropShadow"
428 value: priv.focusedAppDelegate && !priv.focusedAppDelegate.maximized && priv.foregroundMaximizedAppDelegate !== null && mode == "windowed"
451 value: priv.focusedAppDelegate && !priv.focusedAppDelegate.maximized && priv.foregroundMaximizedAppDelegate !== null && mode == "windowed"
431 Binding {
454 Binding {
432− target: PanelState
455+ target: panelState
433 property: "closeButtonShown"
456 property: "closeButtonShown"
434 value: priv.focusedAppDelegate && priv.focusedAppDelegate.maximized && !priv.focusedAppDelegate.isDash
457 value: priv.focusedAppDelegate && priv.focusedAppDelegate.maximized && !priv.focusedAppDelegate.isDash
437 Component.onDestruction: {
460 Component.onDestruction: {
438− PanelState.title = "";
461+ panelState.title = "";
439− PanelState.decorationsVisible = false;
462+ panelState.decorationsVisible = false;
440− PanelState.dropShadow = false;
463+ panelState.dropShadow = false;
443 Instantiator {
466 Instantiator {
@@ -483,6 +506,7 @@ FocusScope {
483 PropertyChanges { target: cancelSpreadMouseArea; enabled: true }
506 PropertyChanges { target: cancelSpreadMouseArea; enabled: true }
484 PropertyChanges { target: blurLayer; visible: true; blurRadius: 32; brightness: .65; opacity: 1 }
507 PropertyChanges { target: blurLayer; visible: true; blurRadius: 32; brightness: .65; opacity: 1 }
485 PropertyChanges { target: wallpaper; visible: false }
508 PropertyChanges { target: wallpaper; visible: false }
509+ PropertyChanges { target: screensAndWorkspaces; opacity: 1 }
488 name: "stagedRightEdge"; when: root.spreadEnabled && (rightEdgeDragArea.dragging || rightEdgePushProgress > 0) && root.mode == "staged"
512 name: "stagedRightEdge"; when: root.spreadEnabled && (rightEdgeDragArea.dragging || rightEdgePushProgress > 0) && root.mode == "staged"
@@ -530,11 +554,18 @@ FocusScope {
530 Transition {
554 Transition {
531 from: "stagedRightEdge,sideStagedRightEdge,windowedRightEdge"; to: "spread"
555 from: "stagedRightEdge,sideStagedRightEdge,windowedRightEdge"; to: "spread"
532 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: -1 }
556 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: -1 }
557+ PropertyAction { target: screensAndWorkspaces; property: "activeWorkspace"; value: WMScreen.currentWorkspace }
558+ ScriptAction { script: { print("blabal***********************", WMScreen.currentWorkspace) } }
533 PropertyAnimation { target: blurLayer; properties: "brightness,blurRadius"; duration: priv.animationDuration }
559 PropertyAnimation { target: blurLayer; properties: "brightness,blurRadius"; duration: priv.animationDuration }
560+ UbuntuNumberAnimation { target: screensAndWorkspaces; property: "opacity"; duration: priv.animationDuration }
535 Transition {
562 Transition {
536 to: "spread"
563 to: "spread"
564+ PropertyAction { target: screensAndWorkspaces; property: "activeWorkspace"; value: WMScreen.currentWorkspace }
565+ ScriptAction { script: { print("blabal***********************", WMScreen.currentWorkspace) } }
537 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: appRepeater.count > 1 ? 1 : 0 }
566 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: appRepeater.count > 1 ? 1 : 0 }
567+ PropertyAction { target: floatingFlickable; property: "contentX"; value: 0 }
568+ UbuntuNumberAnimation { target: screensAndWorkspaces; property: "opacity"; duration: priv.animationDuration }
539 Transition {
570 Transition {
540 from: "spread"
571 from: "spread"
@@ -550,6 +581,7 @@ FocusScope {
551 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: -1 }
582 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: -1 }
552 PropertyAction { target: floatingFlickable; property: "contentX"; value: 0 }
583 PropertyAction { target: floatingFlickable; property: "contentX"; value: 0 }
584+ PropertyAction { target: screensAndWorkspaces; property: "lastClickedWorkspace"; value: null }
555 Transition {
587 Transition {
@@ -592,10 +624,21 @@ FocusScope {
592 visible: false
624 visible: false
627+ ScreensAndWorkspaces {
628+ id: screensAndWorkspaces
629+ anchors { left: parent.left; top: parent.top; right: parent.right; leftMargin: root.leftMargin }
630+ height: Math.max(units.gu(30), parent.height * .3)
631+ background: root.background
633+ visible: opacity > 0
634+ onCloseSpread: priv.goneToSpread = false;
635+ onLastClickedWorkspaceChanged: activeWorkspace = lastClickedWorkspace
596 id: spreadItem
639 id: spreadItem
597 objectName: "spreadItem"
640 objectName: "spreadItem"
598− anchors.fill: appContainer
641+ anchors { left: parent.left; bottom: parent.bottom; right: parent.right; top: screensAndWorkspaces.bottom }
599 leftMargin: root.availableDesktopArea.x
642 leftMargin: root.availableDesktopArea.x
600 model: root.topLevelSurfaceList
643 model: root.topLevelSurfaceList
601 spreadFlickable: floatingFlickable
644 spreadFlickable: floatingFlickable
@@ -610,6 +653,83 @@ FocusScope {
610 appRepeater.itemAt(highlightedIndex).close();
653 appRepeater.itemAt(highlightedIndex).close();
658+ id: floatingFlickable
659+ objectName: "spreadFlickable"
660+ anchors.fill: parent
662+ contentWidth: spreadItem.spreadTotalWidth
664+ function snap(toIndex) {
665+ var delegate = appRepeater.itemAt(toIndex)
666+ var targetContentX = floatingFlickable.contentWidth / spreadItem.totalItemCount * toIndex;
667+ if (targetContentX - floatingFlickable.contentX > spreadItem.rightStackXPos - (spreadItem.spreadItemWidth / 2)) {
668+ var offset = (spreadItem.rightStackXPos - (spreadItem.spreadItemWidth / 2)) - (targetContentX - floatingFlickable.contentX)
669+ snapAnimation.to = floatingFlickable.contentX - offset;
670+ snapAnimation.start();
671+ } else if (targetContentX - floatingFlickable.contentX < spreadItem.leftStackXPos + units.gu(1)) {
672+ var offset = (spreadItem.leftStackXPos + units.gu(1)) - (targetContentX - floatingFlickable.contentX);
673+ snapAnimation.to = floatingFlickable.contentX - offset;
674+ snapAnimation.start();
677+ UbuntuNumberAnimation {id: snapAnimation; target: floatingFlickable; property: "contentX"}
682+ objectName: "hoverMouseArea"
683+ anchors.fill: parent
684+ propagateComposedEvents: true
689+ property int scrollAreaWidth: width / 3
690+ property bool progressiveScrollingEnabled: false
692+ onPressed: mouse.accepted = false
695+ mouse.accepted = false
697+ if (hoverMouseArea.pressed) {
701+ // Find the hovered item and mark it active
702+ for (var i = appRepeater.count - 1; i >= 0; i--) {
703+ var appDelegate = appRepeater.itemAt(i);
704+ var mapped = mapToItem(appDelegate, hoverMouseArea.mouseX, hoverMouseArea.mouseY)
705+ var itemUnder = appDelegate.childAt(mapped.x, mapped.y);
706+ if (itemUnder && (itemUnder.objectName === "dragArea" || itemUnder.objectName === "windowInfoItem" || itemUnder.objectName == "closeMouseArea")) {
707+ spreadItem.highlightedIndex = i;
712+ if (floatingFlickable.contentWidth > floatingFlickable.width) {
713+ var margins = floatingFlickable.width * 0.05;
715+ if (!progressiveScrollingEnabled && mouseX < floatingFlickable.width - scrollAreaWidth) {
716+ progressiveScrollingEnabled = true
719+ // do we need to scroll?
720+ if (mouseX < scrollAreaWidth + margins) {
721+ var progress = Math.min(1, (scrollAreaWidth + margins - mouseX) / (scrollAreaWidth - margins));
722+ var contentX = (1 - progress) * (floatingFlickable.contentWidth - floatingFlickable.width)
723+ floatingFlickable.contentX = Math.max(0, Math.min(floatingFlickable.contentX, contentX))
725+ if (mouseX > floatingFlickable.width - scrollAreaWidth && progressiveScrollingEnabled) {
726+ var progress = Math.min(1, (mouseX - (floatingFlickable.width - scrollAreaWidth)) / (scrollAreaWidth - margins))
727+ var contentX = progress * (floatingFlickable.contentWidth - floatingFlickable.width)
728+ floatingFlickable.contentX = Math.min(floatingFlickable.contentWidth - floatingFlickable.width, Math.max(floatingFlickable.contentX, contentX))
615 Connections {
735 Connections {
@@ -704,6 +824,24 @@ FocusScope {
829+ property real previewScale: .5
830+ height: (screensAndWorkspaces.height - units.gu(8)) / 2
832+ width: implicitWidth * height / implicitHeight
835+ opacity: surface != null ? 1 : 0
836+ Behavior on opacity { UbuntuNumberAnimation {} }
837+ visible: opacity > 0
839+ Drag.active: surface != null
840+ Drag.keys: ["application"]
707 Repeater {
845 Repeater {
708 id: appRepeater
846 id: appRepeater
709 model: topLevelSurfaceList
847 model: topLevelSurfaceList
@@ -732,6 +870,9 @@ FocusScope {
733 z: normalZ
871 z: normalZ
873+ opacity: fakeDragItem.surface == model.window.surface && fakeDragItem.Drag.active ? 0 : 1
874+ Behavior on opacity { UbuntuNumberAnimation {} }
735 // Normally we want x/y where the surface thinks it is. Width/height of our delegate will
876 // Normally we want x/y where the surface thinks it is. Width/height of our delegate will
736 // match what the actual surface size is.
877 // match what the actual surface size is.
737 // Don't write to those, they will be set by states
878 // Don't write to those, they will be set by states
@@ -912,7 +1053,6 @@ FocusScope {
912 function claimFocus() {
1053 function claimFocus() {
913 if (root.state == "spread") {
1054 if (root.state == "spread") {
914 spreadItem.highlightedIndex = index
1055 spreadItem.highlightedIndex = index
915− priv.goneToSpread = false;
917 if (root.mode == "stagedWithSideStage") {
1057 if (root.mode == "stagedWithSideStage") {
918 if (appDelegate.stage == ApplicationInfoInterface.SideStage && !sideStage.shown) {
1058 if (appDelegate.stage == ApplicationInfoInterface.SideStage && !sideStage.shown) {
@@ -1246,8 +1386,6 @@ FocusScope {
1246 y: spreadMaths.targetY
1386 y: spreadMaths.targetY
1247 z: index
1387 z: index
1248 height: spreadItem.spreadItemHeight
1388 height: spreadItem.spreadItemHeight
1249− requestedWidth: decoratedWindow.oldRequestedWidth
1250− requestedHeight: decoratedWindow.oldRequestedHeight
1251 visible: spreadMaths.itemVisible
1389 visible: spreadMaths.itemVisible
1253 PropertyChanges { target: dragArea; enabled: true }
1391 PropertyChanges { target: dragArea; enabled: true }
@@ -1267,8 +1405,6 @@ FocusScope {
1267 y: stagedRightEdgeMaths.animatedY
1405 y: stagedRightEdgeMaths.animatedY
1268 z: stagedRightEdgeMaths.animatedZ
1406 z: stagedRightEdgeMaths.animatedZ
1269 height: stagedRightEdgeMaths.animatedHeight
1407 height: stagedRightEdgeMaths.animatedHeight
1270− requestedWidth: decoratedWindow.oldRequestedWidth
1271− requestedHeight: decoratedWindow.oldRequestedHeight
1272 visible: appDelegate.x < root.width
1408 visible: appDelegate.x < root.width
1274 PropertyChanges {
1410 PropertyChanges {
@@ -1298,8 +1434,6 @@ FocusScope {
1298 y: windowedRightEdgeMaths.animatedY
1434 y: windowedRightEdgeMaths.animatedY
1299 z: windowedRightEdgeMaths.animatedZ
1435 z: windowedRightEdgeMaths.animatedZ
1300 height: stagedRightEdgeMaths.animatedHeight
1436 height: stagedRightEdgeMaths.animatedHeight
1301− requestedWidth: decoratedWindow.oldRequestedWidth
1302− requestedHeight: decoratedWindow.oldRequestedHeight
1304 PropertyChanges {
1438 PropertyChanges {
1305 target: decoratedWindow
1439 target: decoratedWindow
@@ -1322,11 +1456,15 @@ FocusScope {
1322 target: appDelegate
1456 target: appDelegate
1323 x: stageMaths.itemX
1457 x: stageMaths.itemX
1324 y: root.availableDesktopArea.y
1458 y: root.availableDesktopArea.y
1325− requestedWidth: appContainer.width
1326− requestedHeight: root.availableDesktopArea.height
1327 visuallyMaximized: true
1459 visuallyMaximized: true
1328 visible: appDelegate.x < root.width
1460 visible: appDelegate.x < root.width
1463+ target: appDelegate
1464+ requestedWidth: appContainer.width
1465+ requestedHeight: root.availableDesktopArea.height
1466+ restoreEntryValues: false
1330 PropertyChanges {
1468 PropertyChanges {
1331 target: decoratedWindow
1469 target: decoratedWindow
1332 hasDecoration: false
1470 hasDecoration: false
@@ -1355,11 +1493,15 @@ FocusScope {
1355 x: stageMaths.itemX
1493 x: stageMaths.itemX
1356 y: root.availableDesktopArea.y
1494 y: root.availableDesktopArea.y
1357 z: stageMaths.itemZ
1495 z: stageMaths.itemZ
1358− requestedWidth: stageMaths.itemWidth
1359− requestedHeight: root.availableDesktopArea.height
1360 visuallyMaximized: true
1496 visuallyMaximized: true
1361 visible: appDelegate.x < root.width
1497 visible: appDelegate.x < root.width
1500+ target: appDelegate
1501+ requestedWidth: stageMaths.itemWidth
1502+ requestedHeight: root.availableDesktopArea.height
1503+ restoreEntryValues: false
1363 PropertyChanges {
1505 PropertyChanges {
1364 target: decoratedWindow
1506 target: decoratedWindow
1365 hasDecoration: false
1507 hasDecoration: false
@@ -1381,8 +1523,12 @@ FocusScope {
1381 requestedY: 0;
1523 requestedY: 0;
1382 visuallyMinimized: false;
1524 visuallyMinimized: false;
1383 visuallyMaximized: true
1525 visuallyMaximized: true
1528+ target: appDelegate
1384 requestedWidth: root.availableDesktopArea.width;
1529 requestedWidth: root.availableDesktopArea.width;
1385 requestedHeight: appContainer.height;
1530 requestedHeight: appContainer.height;
1531+ restoreEntryValues: false
1387 PropertyChanges { target: touchControls; enabled: true }
1533 PropertyChanges { target: touchControls; enabled: true }
@@ -1392,8 +1538,12 @@ FocusScope {
1392 target: appDelegate;
1538 target: appDelegate;
1393 requestedX: 0
1539 requestedX: 0
1394 requestedY: 0
1540 requestedY: 0
1543+ target: appDelegate
1395− requestedWidth: appContainer.width;
1544+ requestedWidth: appContainer.width
1396− requestedHeight: appContainer.height;
1545+ requestedHeight: appContainer.height
1546+ restoreEntryValues: false
1398 PropertyChanges { target: decoratedWindow; hasDecoration: false }
1548 PropertyChanges { target: decoratedWindow; hasDecoration: false }
@@ -1408,6 +1558,12 @@ FocusScope {
1408 PropertyChanges { target: touchControls; enabled: true }
1558 PropertyChanges { target: touchControls; enabled: true }
1409 PropertyChanges { target: resizeArea; enabled: true }
1559 PropertyChanges { target: resizeArea; enabled: true }
1410 PropertyChanges { target: decoratedWindow; shadowOpacity: .3}
1560 PropertyChanges { target: decoratedWindow; shadowOpacity: .3}
1562+ target: appDelegate
1563+ requestedWidth: windowedWidth
1564+ requestedHeight: windowedHeight
1565+ restoreEntryValues: false
1413 name: "restored";
1569 name: "restored";
@@ -1508,6 +1664,10 @@ FocusScope {
1668+ print("item", index, "state changed", state)
1511 transitions: [
1671 transitions: [
1512 Transition {
1672 Transition {
1513 from: "staged,stagedWithSideStage"
1673 from: "staged,stagedWithSideStage"
@@ -1521,6 +1681,7 @@ FocusScope {
1521 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,requestedX,requestedY,requestedWidth,requestedHeight"; duration: priv.animationDuration}
1681 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,requestedX,requestedY,requestedWidth,requestedHeight"; duration: priv.animationDuration}
1523 Transition {
1683 Transition {
1684+ from: "normal,restored,maximized,maximizedHorizontally,maximizedVertically,maximizedLeft,maximizedRight,maximizedTopLeft,maximizedBottomLeft,maximizedTopRight,maximizedBottomRight,staged,stagedWithSideStage,windowedRightEdge,stagedRightEdge";
1524 to: "spread"
1685 to: "spread"
1525 // DecoratedWindow wants the scaleToPreviewSize set before enabling scaleToPreview
1686 // DecoratedWindow wants the scaleToPreviewSize set before enabling scaleToPreview
1526 PropertyAction { target: appDelegate; properties: "z,visible" }
1687 PropertyAction { target: appDelegate; properties: "z,visible" }
@@ -1606,7 +1767,7 @@ FocusScope {
1608 Binding {
1769 Binding {
1609− target: PanelState
1770+ target: panelState
1610 property: "decorationsAlwaysVisible"
1771 property: "decorationsAlwaysVisible"
1611 value: appDelegate && appDelegate.maximized && touchControls.overlayShown
1772 value: appDelegate && appDelegate.maximized && touchControls.overlayShown
@@ -1627,6 +1788,7 @@ FocusScope {
1627 borderThickness: units.gu(2)
1788 borderThickness: units.gu(2)
1628 enabled: false
1789 enabled: false
1629 visible: enabled
1790 visible: enabled
1791+ readyToAssesBounds: !appDelegate._constructing
1631 onPressed: {
1793 onPressed: {
1632 appDelegate.activate();
1794 appDelegate.activate();
@@ -1650,18 +1812,13 @@ FocusScope {
1650 width: implicitWidth
1812 width: implicitWidth
1651 height: implicitHeight
1813 height: implicitHeight
1652 highlightSize: windowInfoItem.iconMargin / 2
1814 highlightSize: windowInfoItem.iconMargin / 2
1653− altDragEnabled: root.mode == "windowed"
1654 boundsItem: root.availableDesktopArea
1815 boundsItem: root.availableDesktopArea
1816+ panelState: root.panelState
1817+ altDragEnabled: root.mode == "windowed"
1656 requestedWidth: appDelegate.requestedWidth
1819 requestedWidth: appDelegate.requestedWidth
1657 requestedHeight: appDelegate.requestedHeight
1820 requestedHeight: appDelegate.requestedHeight
1659− property int oldRequestedWidth: -1
1660− property int oldRequestedHeight: -1
1662− onRequestedWidthChanged: oldRequestedWidth = requestedWidth
1663− onRequestedHeightChanged: oldRequestedHeight = requestedHeight
1665 onCloseClicked: { appDelegate.close(); }
1822 onCloseClicked: { appDelegate.close(); }
1666 onMaximizeClicked: {
1823 onMaximizeClicked: {
1667 if (appDelegate.canBeMaximized) {
1824 if (appDelegate.canBeMaximized) {
@@ -1742,6 +1899,8 @@ FocusScope {
1742 anchors.fill: decoratedWindow
1899 anchors.fill: decoratedWindow
1743 enabled: false
1900 enabled: false
1744 closeable: !appDelegate.isDash
1901 closeable: !appDelegate.isDash
1903+ dragDelegate: fakeDragItem
1746 onClicked: {
1905 onClicked: {
1747 spreadItem.highlightedIndex = index;
1906 spreadItem.highlightedIndex = index;
@@ -1784,12 +1943,15 @@ FocusScope {
1784 objectName: "closeMouseArea"
1943 objectName: "closeMouseArea"
1785 anchors { left: parent.left; top: parent.top; leftMargin: -height / 2; topMargin: -height / 2 + spreadMaths.closeIconOffset }
1944 anchors { left: parent.left; top: parent.top; leftMargin: -height / 2; topMargin: -height / 2 + spreadMaths.closeIconOffset }
1786 readonly property var mousePos: hoverMouseArea.mapToItem(appDelegate, hoverMouseArea.mouseX, hoverMouseArea.mouseY)
1945 readonly property var mousePos: hoverMouseArea.mapToItem(appDelegate, hoverMouseArea.mouseX, hoverMouseArea.mouseY)
1787− visible: !appDelegate.isDash && dragArea.distance == 0
1946+ readonly property bool shown: !appDelegate.isDash && dragArea.distance == 0
1788 && index == spreadItem.highlightedIndex
1947 && index == spreadItem.highlightedIndex
1789 && mousePos.y < (decoratedWindow.height / 3)
1948 && mousePos.y < (decoratedWindow.height / 3)
1790 && mousePos.y > -units.gu(4)
1949 && mousePos.y > -units.gu(4)
1791 && mousePos.x > -units.gu(4)
1950 && mousePos.x > -units.gu(4)
1792 && mousePos.x < (decoratedWindow.width * 2 / 3)
1951 && mousePos.x < (decoratedWindow.width * 2 / 3)
1952+ opacity: shown ? 1 : 0
1953+ visible: opacity > 0
1954+ Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
1793 height: units.gu(6)
1955 height: units.gu(6)
1794 width: height
1956 width: height
@@ -1860,83 +2022,19 @@ FocusScope {
1860 leftMargin: root.availableDesktopArea.x
2022 leftMargin: root.availableDesktopArea.x
1861 appContainerWidth: appContainer.width
2023 appContainerWidth: appContainer.width
1862 appContainerHeight: appContainer.height
2024 appContainerHeight: appContainer.height
2025+ panelState: root.panelState
1865− MouseArea {
2028+ WorkspaceSwitcher {
1866− id: hoverMouseArea
2029+ id: workspaceSwitcher
1867− objectName: "hoverMouseArea"
2030+ anchors.centerIn: parent
1868− anchors.fill: appContainer
2031+ height: units.gu(20)
1869− propagateComposedEvents: true
2032+ background: root.background
1870− hoverEnabled: true
2033+ onActiveChanged: {
1871− enabled: false
2034+ if (!active) {
1872− visible: enabled
2035+ appContainer.focus = true;
1874− property int scrollAreaWidth: width / 3
1875− property bool progressiveScrollingEnabled: false
1878− mouse.accepted = false
1880− if (hoverMouseArea.pressed) {
1884− // Find the hovered item and mark it active
1885− for (var i = appRepeater.count - 1; i >= 0; i--) {
1886− var appDelegate = appRepeater.itemAt(i);
1887− var mapped = mapToItem(appDelegate, hoverMouseArea.mouseX, hoverMouseArea.mouseY)
1888− var itemUnder = appDelegate.childAt(mapped.x, mapped.y);
1889− if (itemUnder && (itemUnder.objectName === "dragArea" || itemUnder.objectName === "windowInfoItem" || itemUnder.objectName == "closeMouseArea")) {
1890− spreadItem.highlightedIndex = i;
1895− if (floatingFlickable.contentWidth > floatingFlickable.width) {
1896− var margins = floatingFlickable.width * 0.05;
1898− if (!progressiveScrollingEnabled && mouseX < floatingFlickable.width - scrollAreaWidth) {
1899− progressiveScrollingEnabled = true
1902− // do we need to scroll?
1903− if (mouseX < scrollAreaWidth + margins) {
1904− var progress = Math.min(1, (scrollAreaWidth + margins - mouseX) / (scrollAreaWidth - margins));
1905− var contentX = (1 - progress) * (floatingFlickable.contentWidth - floatingFlickable.width)
1906− floatingFlickable.contentX = Math.max(0, Math.min(floatingFlickable.contentX, contentX))
1908− if (mouseX > floatingFlickable.width - scrollAreaWidth && progressiveScrollingEnabled) {
1909− var progress = Math.min(1, (mouseX - (floatingFlickable.width - scrollAreaWidth)) / (scrollAreaWidth - margins))
1910− var contentX = progress * (floatingFlickable.contentWidth - floatingFlickable.width)
1911− floatingFlickable.contentX = Math.min(floatingFlickable.contentWidth - floatingFlickable.width, Math.max(floatingFlickable.contentX, contentX))
1916− onPressed: mouse.accepted = false
1919− FloatingFlickable {
1920− id: floatingFlickable
1921− objectName: "spreadFlickable"
1922− anchors.fill: appContainer
1924− contentWidth: spreadItem.spreadTotalWidth
1926− function snap(toIndex) {
1927− var delegate = appRepeater.itemAt(toIndex)
1928− var targetContentX = floatingFlickable.contentWidth / spreadItem.totalItemCount * toIndex;
1929− if (targetContentX - floatingFlickable.contentX > spreadItem.rightStackXPos - (spreadItem.spreadItemWidth / 2)) {
1930− var offset = (spreadItem.rightStackXPos - (spreadItem.spreadItemWidth / 2)) - (targetContentX - floatingFlickable.contentX)
1931− snapAnimation.to = Math.max(0, floatingFlickable.contentX - offset);
1932− snapAnimation.start();
1933− } else if (targetContentX - floatingFlickable.contentX < spreadItem.leftStackXPos + units.gu(1)) {
1934− var offset = (spreadItem.leftStackXPos + units.gu(1)) - (targetContentX - floatingFlickable.contentX);
1935− snapAnimation.to = Math.max(0, floatingFlickable.contentX - offset);
1936− snapAnimation.start();
1939− UbuntuNumberAnimation {id: snapAnimation; target: floatingFlickable; property: "contentX"}
1942 PropertyAnimation {
2040 PropertyAnimation {