@@ -47,6 +47,7 @@ FocusScope {
4747 property bool oskEnabled: false
4848 property rect inputMethodRect
4949 property real rightEdgePushProgress: 0
50+ property PanelState panelState
5051
5152 // Configuration
5253 property string mode: "staged"
@@ -224,6 +225,25 @@ FocusScope {
224225 active: priv.focusedAppDelegate !== null
225226 }
226227
228+ GlobalShortcut {
229+ id: showWorkspaceSwitcherShortcutLeft
230+ shortcut: Qt.AltModifier|Qt.ControlModifier|Qt.Key_Left
231+ active: !workspaceSwitcher.active
232+ onTriggered: {
233+ root.focus = true;
234+ workspaceSwitcher.showLeft()
235+ }
236+ }
237+ GlobalShortcut {
238+ id: showWorkspaceSwitcherShortcutRight
239+ shortcut: Qt.AltModifier|Qt.ControlModifier|Qt.Key_Right
240+ active: !workspaceSwitcher.active
241+ onTriggered: {
242+ root.focus = true;
243+ workspaceSwitcher.showRight()
244+ }
245+ }
246+
227247 QtObject {
228248 id: priv
229249 objectName: "DesktopStagePrivate"
@@ -349,23 +369,23 @@ FocusScope {
349369 readonly property real virtualKeyboardHeight: root.inputMethodRect.height
350370 }
351371
352− Component.onCompleted: priv.updateMainAndSideStageIndexes();
372+ Component.onCompleted: priv.updateMainAndSideStageIndexes()
353373
354374 Connections {
355− target: PanelState
375+ target: panelState
356376 onCloseClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.close(); } }
357377 onMinimizeClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.requestMinimize(); } }
358378 onRestoreClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.requestRestore(); } }
359379 }
360380
361381 Binding {
362− target: PanelState
382+ target: panelState
363383 property: "decorationsVisible"
364384 value: priv.focusedAppDelegate !== null && priv.focusedAppDelegate.maximized // FIXME for Locally integrated menus
365385 }
366386
367387 Binding {
368− target: PanelState
388+ target: panelState
369389 property: "title"
370390 value: {
371391 if (priv.focusedAppDelegate !== null) {
@@ -380,7 +400,7 @@ FocusScope {
380400 }
381401
382402 Binding {
383− target: PanelState
403+ target: panelState
384404 property: "focusedPersistentSurfaceId"
385405 value: {
386406 if (priv.focusedAppDelegate !== null) {
@@ -394,21 +414,21 @@ FocusScope {
394414 }
395415
396416 Binding {
397− target: PanelState
417+ target: panelState
398418 property: "dropShadow"
399419 value: priv.focusedAppDelegate && !priv.focusedAppDelegate.maximized && priv.foregroundMaximizedAppDelegate !== null && mode == "windowed"
400420 }
401421
402422 Binding {
403− target: PanelState
423+ target: panelState
404424 property: "closeButtonShown"
405425 value: priv.focusedAppDelegate && priv.focusedAppDelegate.maximized && !priv.focusedAppDelegate.isDash
406426 }
407427
408428 Component.onDestruction: {
409− PanelState.title = "";
410− PanelState.decorationsVisible = false;
411− PanelState.dropShadow = false;
429+ panelState.title = "";
430+ panelState.decorationsVisible = false;
431+ panelState.dropShadow = false;
412432 }
413433
414434 Instantiator {
@@ -454,6 +474,7 @@ FocusScope {
454474 PropertyChanges { target: cancelSpreadMouseArea; enabled: true }
455475 PropertyChanges { target: blurLayer; visible: true; blurRadius: 32; brightness: .65; opacity: 1 }
456476 PropertyChanges { target: wallpaper; visible: false }
477+ PropertyChanges { target: screensAndWorkspaces; opacity: 1 }
457478 },
458479 State {
459480 name: "stagedRightEdge"; when: root.spreadEnabled && (rightEdgeDragArea.dragging || rightEdgePushProgress > 0) && root.mode == "staged"
@@ -502,10 +523,13 @@ FocusScope {
502523 from: "stagedRightEdge,sideStagedRightEdge,windowedRightEdge"; to: "spread"
503524 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: -1 }
504525 PropertyAnimation { target: blurLayer; properties: "brightness,blurRadius"; duration: priv.animationDuration }
526+ UbuntuNumberAnimation { target: screensAndWorkspaces; property: "opacity"; duration: priv.animationDuration }
505527 },
506528 Transition {
507529 to: "spread"
508530 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: appRepeater.count > 1 ? 1 : 0 }
531+ PropertyAction { target: floatingFlickable; property: "contentX"; value: 0 }
532+ UbuntuNumberAnimation { target: screensAndWorkspaces; property: "opacity"; duration: priv.animationDuration }
509533 },
510534 Transition {
511535 from: "spread"
@@ -563,10 +587,21 @@ FocusScope {
563587 visible: false
564588 }
565589
590+ ScreensAndWorkspaces {
591+ id: screensAndWorkspaces
592+ anchors { left: parent.left; top: parent.top; right: parent.right; leftMargin: root.leftMargin }
593+ height: Math.max(units.gu(30), parent.height * .3)
594+ background: root.background
595+ opacity: 0
596+ visible: opacity > 0
597+
598+ onCloseSpread: priv.goneToSpread = false;
599+ }
600+
566601 Spread {
567602 id: spreadItem
568603 objectName: "spreadItem"
569− anchors.fill: appContainer
604+ anchors { left: parent.left; bottom: parent.bottom; right: parent.right; top: screensAndWorkspaces.bottom }
570605 leftMargin: root.leftMargin
571606 model: root.topLevelSurfaceList
572607 spreadFlickable: floatingFlickable
@@ -581,6 +616,83 @@ FocusScope {
581616 appRepeater.itemAt(highlightedIndex).close();
582617 }
583618 }
619+
620+ FloatingFlickable {
621+ id: floatingFlickable
622+ objectName: "spreadFlickable"
623+ anchors.fill: parent
624+ enabled: false
625+ contentWidth: spreadItem.spreadTotalWidth
626+
627+ function snap(toIndex) {
628+ var delegate = appRepeater.itemAt(toIndex)
629+ var targetContentX = floatingFlickable.contentWidth / spreadItem.totalItemCount * toIndex;
630+ if (targetContentX - floatingFlickable.contentX > spreadItem.rightStackXPos - (spreadItem.spreadItemWidth / 2)) {
631+ var offset = (spreadItem.rightStackXPos - (spreadItem.spreadItemWidth / 2)) - (targetContentX - floatingFlickable.contentX)
632+ snapAnimation.to = floatingFlickable.contentX - offset;
633+ snapAnimation.start();
634+ } else if (targetContentX - floatingFlickable.contentX < spreadItem.leftStackXPos + units.gu(1)) {
635+ var offset = (spreadItem.leftStackXPos + units.gu(1)) - (targetContentX - floatingFlickable.contentX);
636+ snapAnimation.to = floatingFlickable.contentX - offset;
637+ snapAnimation.start();
638+ }
639+ }
640+ UbuntuNumberAnimation {id: snapAnimation; target: floatingFlickable; property: "contentX"}
641+ }
642+
643+ MouseArea {
644+ id: hoverMouseArea
645+ objectName: "hoverMouseArea"
646+ anchors.fill: parent
647+ propagateComposedEvents: true
648+ hoverEnabled: true
649+ enabled: false
650+ visible: enabled
651+
652+ property int scrollAreaWidth: width / 3
653+ property bool progressiveScrollingEnabled: false
654+
655+ onPressed: mouse.accepted = false
656+
657+ onMouseXChanged: {
658+ mouse.accepted = false
659+
660+ if (hoverMouseArea.pressed) {
661+ return;
662+ }
663+
664+ // Find the hovered item and mark it active
665+ for (var i = appRepeater.count - 1; i >= 0; i--) {
666+ var appDelegate = appRepeater.itemAt(i);
667+ var mapped = mapToItem(appDelegate, hoverMouseArea.mouseX, hoverMouseArea.mouseY)
668+ var itemUnder = appDelegate.childAt(mapped.x, mapped.y);
669+ if (itemUnder && (itemUnder.objectName === "dragArea" || itemUnder.objectName === "windowInfoItem" || itemUnder.objectName == "closeMouseArea")) {
670+ spreadItem.highlightedIndex = i;
671+ break;
672+ }
673+ }
674+
675+ if (floatingFlickable.contentWidth > floatingFlickable.width) {
676+ var margins = floatingFlickable.width * 0.05;
677+
678+ if (!progressiveScrollingEnabled && mouseX < floatingFlickable.width - scrollAreaWidth) {
679+ progressiveScrollingEnabled = true
680+ }
681+
682+ // do we need to scroll?
683+ if (mouseX < scrollAreaWidth + margins) {
684+ var progress = Math.min(1, (scrollAreaWidth + margins - mouseX) / (scrollAreaWidth - margins));
685+ var contentX = (1 - progress) * (floatingFlickable.contentWidth - floatingFlickable.width)
686+ floatingFlickable.contentX = Math.max(0, Math.min(floatingFlickable.contentX, contentX))
687+ }
688+ if (mouseX > floatingFlickable.width - scrollAreaWidth && progressiveScrollingEnabled) {
689+ var progress = Math.min(1, (mouseX - (floatingFlickable.width - scrollAreaWidth)) / (scrollAreaWidth - margins))
690+ var contentX = progress * (floatingFlickable.contentWidth - floatingFlickable.width)
691+ floatingFlickable.contentX = Math.min(floatingFlickable.contentWidth - floatingFlickable.width, Math.max(floatingFlickable.contentX, contentX))
692+ }
693+ }
694+ }
695+ }
584696 }
585697
586698 Connections {
@@ -675,10 +787,28 @@ FocusScope {
675787 }
676788 }
677789
790+ MirSurfaceItem {
791+ id: fakeDragItem
792+ property real previewScale: .5
793+ height: (screensAndWorkspaces.height - units.gu(8)) / 2
794+ // w : h = iw : ih
795+ width: implicitWidth * height / implicitHeight
796+ surfaceWidth: -1
797+ surfaceHeight: -1
798+ opacity: surface != null ? 1 : 0
799+ Behavior on opacity { UbuntuNumberAnimation {} }
800+ visible: opacity > 0
801+
802+ Drag.active: surface != null
803+ Drag.keys: ["application"]
804+
805+ z: 1000
806+ }
807+
678808 Item {
679809 id: boundariesForWindowPlacement
680810 anchors.fill: parent
681− anchors.topMargin: PanelState.panelHeight
811+ anchors.topMargin: panelState.panelHeight
682812 visible: false
683813 }
684814
@@ -710,6 +840,9 @@ FocusScope {
710840 }
711841 z: normalZ
712842
843+ opacity: fakeDragItem.surface == model.window.surface && fakeDragItem.Drag.active ? 0 : 1
844+ Behavior on opacity { UbuntuNumberAnimation {} }
845+
713846 // Normally we want x/y where the surface thinks it is. Width/height of our delegate will
714847 // match what the actual surface size is.
715848 // Don't write to those, they will be set by states
@@ -779,7 +912,7 @@ FocusScope {
779912 target: appDelegate
780913 property: "y"
781914 value: appDelegate.requestedY -
782− Math.min(appDelegate.requestedY - PanelState.panelHeight,
915+ Math.min(appDelegate.requestedY - panelState.panelHeight,
783916 Math.max(0, priv.virtualKeyboardHeight - (appContainer.height - (appDelegate.requestedY + appDelegate.height))))
784917 when: root.oskEnabled && appDelegate.focus && (appDelegate.state == "normal" || appDelegate.state == "restored")
785918 && root.inputMethodRect.height > 0
@@ -890,7 +1023,6 @@ FocusScope {
8901023 function claimFocus() {
8911024 if (root.state == "spread") {
8921025 spreadItem.highlightedIndex = index
893− priv.goneToSpread = false;
8941026 }
8951027 if (root.mode == "stagedWithSideStage") {
8961028 if (appDelegate.stage == ApplicationInfoInterface.SideStage && !sideStage.shown) {
@@ -1177,7 +1309,7 @@ FocusScope {
11771309 progress: 0
11781310 targetHeight: spreadItem.stackHeight
11791311 targetX: spreadMaths.targetX
1180− startY: appDelegate.fullscreen ? 0 : PanelState.panelHeight
1312+ startY: appDelegate.fullscreen ? 0 : panelState.panelHeight
11811313 targetY: spreadMaths.targetY
11821314 targetAngle: spreadMaths.targetAngle
11831315 targetScale: spreadMaths.targetScale
@@ -1223,8 +1355,6 @@ FocusScope {
12231355 y: spreadMaths.targetY
12241356 z: index
12251357 height: spreadItem.spreadItemHeight
1226− requestedWidth: decoratedWindow.oldRequestedWidth
1227− requestedHeight: decoratedWindow.oldRequestedHeight
12281358 visible: spreadMaths.itemVisible
12291359 }
12301360 PropertyChanges { target: dragArea; enabled: true }
@@ -1244,8 +1374,6 @@ FocusScope {
12441374 y: stagedRightEdgeMaths.animatedY
12451375 z: stagedRightEdgeMaths.animatedZ
12461376 height: stagedRightEdgeMaths.animatedHeight
1247− requestedWidth: decoratedWindow.oldRequestedWidth
1248− requestedHeight: decoratedWindow.oldRequestedHeight
12491377 visible: appDelegate.x < root.width
12501378 }
12511379 PropertyChanges {
@@ -1275,8 +1403,6 @@ FocusScope {
12751403 y: windowedRightEdgeMaths.animatedY
12761404 z: windowedRightEdgeMaths.animatedZ
12771405 height: stagedRightEdgeMaths.animatedHeight
1278− requestedWidth: decoratedWindow.oldRequestedWidth
1279− requestedHeight: decoratedWindow.oldRequestedHeight
12801406 }
12811407 PropertyChanges {
12821408 target: decoratedWindow
@@ -1298,12 +1424,16 @@ FocusScope {
12981424 PropertyChanges {
12991425 target: appDelegate
13001426 x: stageMaths.itemX
1301− y: appDelegate.fullscreen ? 0 : PanelState.panelHeight
1302− requestedWidth: appContainer.width
1303− requestedHeight: appDelegate.fullscreen ? appContainer.height : appContainer.height - PanelState.panelHeight
1427+ y: appDelegate.fullscreen ? 0 : panelState.panelHeight
13041428 visuallyMaximized: true
13051429 visible: appDelegate.x < root.width
13061430 }
1431+ PropertyChanges {
1432+ target: appDelegate
1433+ requestedWidth: appContainer.width
1434+ requestedHeight: appDelegate.fullscreen ? appContainer.height : appContainer.height - panelState.panelHeight
1435+ restoreEntryValues: false
1436+ }
13071437 PropertyChanges {
13081438 target: decoratedWindow
13091439 hasDecoration: false
@@ -1330,13 +1460,17 @@ FocusScope {
13301460 PropertyChanges {
13311461 target: appDelegate
13321462 x: stageMaths.itemX
1333− y: appDelegate.fullscreen ? 0 : PanelState.panelHeight
1463+ y: appDelegate.fullscreen ? 0 : panelState.panelHeight
13341464 z: stageMaths.itemZ
1335− requestedWidth: stageMaths.itemWidth
1336− requestedHeight: appDelegate.fullscreen ? appContainer.height : appContainer.height - PanelState.panelHeight
13371465 visuallyMaximized: true
13381466 visible: appDelegate.x < root.width
13391467 }
1468+ PropertyChanges {
1469+ target: appDelegate
1470+ requestedWidth: stageMaths.itemWidth
1471+ requestedHeight: appDelegate.fullscreen ? appContainer.height : appContainer.height - panelState.panelHeight
1472+ restoreEntryValues: false
1473+ }
13401474 PropertyChanges {
13411475 target: decoratedWindow
13421476 hasDecoration: false
@@ -1358,8 +1492,12 @@ FocusScope {
13581492 requestedY: 0;
13591493 visuallyMinimized: false;
13601494 visuallyMaximized: true
1361− requestedWidth: appContainer.width - root.leftMargin;
1362− requestedHeight: appContainer.height;
1495+ }
1496+ PropertyChanges {
1497+ target: appDelegate
1498+ requestedWidth: appContainer.width - root.leftMargin
1499+ requestedHeight: appContainer.height
1500+ restoreEntryValues: false
13631501 }
13641502 PropertyChanges { target: touchControls; enabled: true }
13651503 },
@@ -1369,8 +1507,12 @@ FocusScope {
13691507 target: appDelegate;
13701508 requestedX: 0
13711509 requestedY: 0
1372− requestedWidth: appContainer.width;
1373− requestedHeight: appContainer.height;
1510+ }
1511+ PropertyChanges {
1512+ target: appDelegate
1513+ requestedWidth: appContainer.width
1514+ requestedHeight: appContainer.height
1515+ restoreEntryValues: false
13741516 }
13751517 PropertyChanges { target: decoratedWindow; hasDecoration: false }
13761518 },
@@ -1385,6 +1527,12 @@ FocusScope {
13851527 PropertyChanges { target: touchControls; enabled: true }
13861528 PropertyChanges { target: resizeArea; enabled: true }
13871529 PropertyChanges { target: decoratedWindow; shadowOpacity: .3}
1530+ PropertyChanges {
1531+ target: appDelegate
1532+ requestedWidth: windowedWidth
1533+ requestedHeight: windowedHeight
1534+ restoreEntryValues: false
1535+ }
13881536 },
13891537 State {
13901538 name: "restored";
@@ -1402,9 +1550,9 @@ FocusScope {
14021550 PropertyChanges {
14031551 target: appDelegate
14041552 windowedX: root.leftMargin
1405− windowedY: PanelState.panelHeight
1553+ windowedY: panelState.panelHeight
14061554 windowedWidth: (appContainer.width - root.leftMargin)/2
1407− windowedHeight: appContainer.height - PanelState.panelHeight
1555+ windowedHeight: appContainer.height - panelState.panelHeight
14081556 }
14091557 },
14101558 State {
@@ -1421,9 +1569,9 @@ FocusScope {
14211569 PropertyChanges {
14221570 target: appDelegate
14231571 windowedX: root.leftMargin
1424− windowedY: PanelState.panelHeight
1572+ windowedY: panelState.panelHeight
14251573 windowedWidth: (appContainer.width - root.leftMargin)/2
1426− windowedHeight: (appContainer.height - PanelState.panelHeight)/2
1574+ windowedHeight: (appContainer.height - panelState.panelHeight)/2
14271575 }
14281576 },
14291577 State {
@@ -1440,7 +1588,7 @@ FocusScope {
14401588 PropertyChanges {
14411589 target: appDelegate
14421590 windowedX: root.leftMargin
1443− windowedY: (appContainer.height + PanelState.panelHeight)/2
1591+ windowedY: (appContainer.height + panelState.panelHeight)/2
14441592 windowedWidth: (appContainer.width - root.leftMargin)/2
14451593 windowedHeight: appContainer.height/2
14461594 }
@@ -1462,8 +1610,8 @@ FocusScope {
14621610 State {
14631611 name: "maximizedVertically"; when: appDelegate.maximizedVertically && !appDelegate.minimized
14641612 extend: "normal"
1465− PropertyChanges { target: appDelegate; windowedX: windowedX; windowedY: PanelState.panelHeight;
1466− windowedWidth: windowedWidth; windowedHeight: appContainer.height - PanelState.panelHeight }
1613+ PropertyChanges { target: appDelegate; windowedX: windowedX; windowedY: panelState.panelHeight;
1614+ windowedWidth: windowedWidth; windowedHeight: appContainer.height - panelState.panelHeight }
14671615 },
14681616 State {
14691617 name: "minimized"; when: appDelegate.minimized
@@ -1478,6 +1626,10 @@ FocusScope {
14781626 }
14791627 }
14801628 ]
1629+ onStateChanged: {
1630+ print("item", index, "state changed", state)
1631+ }
1632+
14811633 transitions: [
14821634 Transition {
14831635 from: "staged,stagedWithSideStage"
@@ -1491,6 +1643,7 @@ FocusScope {
14911643 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,requestedX,requestedY,requestedWidth,requestedHeight"; duration: priv.animationDuration}
14921644 },
14931645 Transition {
1646+ from: "normal,restored,maximized,maximizedHorizontally,maximizedVertically,maximizedLeft,maximizedRight,maximizedTopLeft,maximizedBottomLeft,maximizedTopRight,maximizedBottomRight,staged,stagedWithSideStage,windowedRightEdge,stagedRightEdge";
14941647 to: "spread"
14951648 // DecoratedWindow wants the scaleToPreviewSize set before enabling scaleToPreview
14961649 PropertyAction { target: appDelegate; properties: "z,visible" }
@@ -1576,7 +1729,7 @@ FocusScope {
15761729 ]
15771730
15781731 Binding {
1579− target: PanelState
1732+ target: panelState
15801733 property: "decorationsAlwaysVisible"
15811734 value: appDelegate && appDelegate.maximized && touchControls.overlayShown
15821735 }
@@ -1597,6 +1750,7 @@ FocusScope {
15971750 borderThickness: units.gu(2)
15981751 enabled: false
15991752 visible: enabled
1753+ readyToAssesBounds: !appDelegate._constructing
16001754
16011755 onPressed: {
16021756 appDelegate.activate();
@@ -1620,17 +1774,12 @@ FocusScope {
16201774 height: implicitHeight
16211775 highlightSize: windowInfoItem.iconMargin / 2
16221776 boundsItem: boundariesForWindowPlacement
1777+ panelState: root.panelState
16231778 altDragEnabled: root.mode == "windowed"
16241779
16251780 requestedWidth: appDelegate.requestedWidth
16261781 requestedHeight: appDelegate.requestedHeight
16271782
1628− property int oldRequestedWidth: -1
1629− property int oldRequestedHeight: -1
1630−
1631− onRequestedWidthChanged: oldRequestedWidth = requestedWidth
1632− onRequestedHeightChanged: oldRequestedHeight = requestedHeight
1633−
16341783 onCloseClicked: { appDelegate.close(); }
16351784 onMaximizeClicked: {
16361785 if (appDelegate.canBeMaximized) {
@@ -1711,6 +1860,8 @@ FocusScope {
17111860 anchors.fill: decoratedWindow
17121861 enabled: false
17131862 closeable: !appDelegate.isDash
1863+ stage: root
1864+ dragDelegate: fakeDragItem
17141865
17151866 onClicked: {
17161867 spreadItem.highlightedIndex = index;
@@ -1753,12 +1904,15 @@ FocusScope {
17531904 objectName: "closeMouseArea"
17541905 anchors { left: parent.left; top: parent.top; leftMargin: -height / 2; topMargin: -height / 2 + spreadMaths.closeIconOffset }
17551906 readonly property var mousePos: hoverMouseArea.mapToItem(appDelegate, hoverMouseArea.mouseX, hoverMouseArea.mouseY)
1756− visible: !appDelegate.isDash && dragArea.distance == 0
1907+ readonly property bool shown: !appDelegate.isDash && dragArea.distance == 0
17571908 && index == spreadItem.highlightedIndex
17581909 && mousePos.y < (decoratedWindow.height / 3)
17591910 && mousePos.y > -units.gu(4)
17601911 && mousePos.x > -units.gu(4)
17611912 && mousePos.x < (decoratedWindow.width * 2 / 3)
1913+ opacity: shown ? 1 : 0
1914+ visible: opacity > 0
1915+ Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
17621916 height: units.gu(6)
17631917 width: height
17641918
@@ -1820,83 +1974,19 @@ FocusScope {
18201974 leftMargin: root.leftMargin
18211975 appContainerWidth: appContainer.width
18221976 appContainerHeight: appContainer.height
1977+ panelState: root.panelState
18231978 }
18241979
1825− MouseArea {
1826− id: hoverMouseArea
1827− objectName: "hoverMouseArea"
1828− anchors.fill: appContainer
1829− propagateComposedEvents: true
1830− hoverEnabled: true
1831− enabled: false
1832− visible: enabled
1833−
1834− property int scrollAreaWidth: width / 3
1835− property bool progressiveScrollingEnabled: false
1836−
1837− onMouseXChanged: {
1838− mouse.accepted = false
1839−
1840− if (hoverMouseArea.pressed) {
1841− return;
1842− }
1843−
1844− // Find the hovered item and mark it active
1845− for (var i = appRepeater.count - 1; i >= 0; i--) {
1846− var appDelegate = appRepeater.itemAt(i);
1847− var mapped = mapToItem(appDelegate, hoverMouseArea.mouseX, hoverMouseArea.mouseY)
1848− var itemUnder = appDelegate.childAt(mapped.x, mapped.y);
1849− if (itemUnder && (itemUnder.objectName === "dragArea" || itemUnder.objectName === "windowInfoItem" || itemUnder.objectName == "closeMouseArea")) {
1850− spreadItem.highlightedIndex = i;
1851− break;
1852− }
1853− }
1854−
1855− if (floatingFlickable.contentWidth > floatingFlickable.width) {
1856− var margins = floatingFlickable.width * 0.05;
1857−
1858− if (!progressiveScrollingEnabled && mouseX < floatingFlickable.width - scrollAreaWidth) {
1859− progressiveScrollingEnabled = true
1860− }
1861−
1862− // do we need to scroll?
1863− if (mouseX < scrollAreaWidth + margins) {
1864− var progress = Math.min(1, (scrollAreaWidth + margins - mouseX) / (scrollAreaWidth - margins));
1865− var contentX = (1 - progress) * (floatingFlickable.contentWidth - floatingFlickable.width)
1866− floatingFlickable.contentX = Math.max(0, Math.min(floatingFlickable.contentX, contentX))
1867− }
1868− if (mouseX > floatingFlickable.width - scrollAreaWidth && progressiveScrollingEnabled) {
1869− var progress = Math.min(1, (mouseX - (floatingFlickable.width - scrollAreaWidth)) / (scrollAreaWidth - margins))
1870− var contentX = progress * (floatingFlickable.contentWidth - floatingFlickable.width)
1871− floatingFlickable.contentX = Math.min(floatingFlickable.contentWidth - floatingFlickable.width, Math.max(floatingFlickable.contentX, contentX))
1872− }
1873− }
1874− }
1875−
1876− onPressed: mouse.accepted = false
1877− }
1878−
1879− FloatingFlickable {
1880− id: floatingFlickable
1881− objectName: "spreadFlickable"
1882− anchors.fill: appContainer
1883− enabled: false
1884− contentWidth: spreadItem.spreadTotalWidth
1885−
1886− function snap(toIndex) {
1887− var delegate = appRepeater.itemAt(toIndex)
1888− var targetContentX = floatingFlickable.contentWidth / spreadItem.totalItemCount * toIndex;
1889− if (targetContentX - floatingFlickable.contentX > spreadItem.rightStackXPos - (spreadItem.spreadItemWidth / 2)) {
1890− var offset = (spreadItem.rightStackXPos - (spreadItem.spreadItemWidth / 2)) - (targetContentX - floatingFlickable.contentX)
1891− snapAnimation.to = Math.max(0, floatingFlickable.contentX - offset);
1892− snapAnimation.start();
1893− } else if (targetContentX - floatingFlickable.contentX < spreadItem.leftStackXPos + units.gu(1)) {
1894− var offset = (spreadItem.leftStackXPos + units.gu(1)) - (targetContentX - floatingFlickable.contentX);
1895− snapAnimation.to = Math.max(0, floatingFlickable.contentX - offset);
1896− snapAnimation.start();
1980+ WorkspaceSwitcher {
1981+ id: workspaceSwitcher
1982+ anchors.centerIn: parent
1983+ height: units.gu(20)
1984+ background: root.background
1985+ onActiveChanged: {
1986+ if (!active) {
1987+ appContainer.focus = true;
18971988 }
18981989 }
1899− UbuntuNumberAnimation {id: snapAnimation; target: floatingFlickable; property: "contentX"}
19001990 }
19011991
19021992 PropertyAnimation {