@@ -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,23 @@ 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+ workspaceSwitcher.showLeft()
234+ }
235+ }
236+ GlobalShortcut {
237+ id: showWorkspaceSwitcherShortcutRight
238+ shortcut: Qt.AltModifier|Qt.ControlModifier|Qt.Key_Right
239+ active: !workspaceSwitcher.active
240+ onTriggered: {
241+ workspaceSwitcher.showRight()
242+ }
243+ }
244+
227245 QtObject {
228246 id: priv
229247 objectName: "DesktopStagePrivate"
@@ -349,23 +367,23 @@ FocusScope {
349367 readonly property real virtualKeyboardHeight: root.inputMethodRect.height
350368 }
351369
352− Component.onCompleted: priv.updateMainAndSideStageIndexes();
370+ Component.onCompleted: priv.updateMainAndSideStageIndexes()
353371
354372 Connections {
355− target: PanelState
373+ target: panelState
356374 onCloseClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.close(); } }
357375 onMinimizeClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.requestMinimize(); } }
358376 onRestoreClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.requestRestore(); } }
359377 }
360378
361379 Binding {
362− target: PanelState
380+ target: panelState
363381 property: "decorationsVisible"
364382 value: priv.focusedAppDelegate !== null && priv.focusedAppDelegate.maximized // FIXME for Locally integrated menus
365383 }
366384
367385 Binding {
368− target: PanelState
386+ target: panelState
369387 property: "title"
370388 value: {
371389 if (priv.focusedAppDelegate !== null) {
@@ -380,7 +398,7 @@ FocusScope {
380398 }
381399
382400 Binding {
383− target: PanelState
401+ target: panelState
384402 property: "focusedPersistentSurfaceId"
385403 value: {
386404 if (priv.focusedAppDelegate !== null) {
@@ -394,21 +412,21 @@ FocusScope {
394412 }
395413
396414 Binding {
397− target: PanelState
415+ target: panelState
398416 property: "dropShadow"
399417 value: priv.focusedAppDelegate && !priv.focusedAppDelegate.maximized && priv.foregroundMaximizedAppDelegate !== null && mode == "windowed"
400418 }
401419
402420 Binding {
403− target: PanelState
421+ target: panelState
404422 property: "closeButtonShown"
405423 value: priv.focusedAppDelegate && priv.focusedAppDelegate.maximized && !priv.focusedAppDelegate.isDash
406424 }
407425
408426 Component.onDestruction: {
409− PanelState.title = "";
410− PanelState.decorationsVisible = false;
411− PanelState.dropShadow = false;
427+ panelState.title = "";
428+ panelState.decorationsVisible = false;
429+ panelState.dropShadow = false;
412430 }
413431
414432 Instantiator {
@@ -454,6 +472,7 @@ FocusScope {
454472 PropertyChanges { target: cancelSpreadMouseArea; enabled: true }
455473 PropertyChanges { target: blurLayer; visible: true; blurRadius: 32; brightness: .65; opacity: 1 }
456474 PropertyChanges { target: wallpaper; visible: false }
475+ PropertyChanges { target: screensAndWorkspaces; opacity: 1 }
457476 },
458477 State {
459478 name: "stagedRightEdge"; when: root.spreadEnabled && (rightEdgeDragArea.dragging || rightEdgePushProgress > 0) && root.mode == "staged"
@@ -502,10 +521,13 @@ FocusScope {
502521 from: "stagedRightEdge,sideStagedRightEdge,windowedRightEdge"; to: "spread"
503522 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: -1 }
504523 PropertyAnimation { target: blurLayer; properties: "brightness,blurRadius"; duration: priv.animationDuration }
524+ UbuntuNumberAnimation { target: screensAndWorkspaces; property: "opacity"; duration: priv.animationDuration }
505525 },
506526 Transition {
507527 to: "spread"
508528 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: appRepeater.count > 1 ? 1 : 0 }
529+ PropertyAction { target: floatingFlickable; property: "contentX"; value: 0 }
530+ UbuntuNumberAnimation { target: screensAndWorkspaces; property: "opacity"; duration: priv.animationDuration }
509531 },
510532 Transition {
511533 from: "spread"
@@ -563,10 +585,21 @@ FocusScope {
563585 visible: false
564586 }
565587
588+ ScreensAndWorkspaces {
589+ id: screensAndWorkspaces
590+ anchors { left: parent.left; top: parent.top; right: parent.right; leftMargin: root.leftMargin }
591+ height: Math.max(units.gu(30), parent.height * .3)
592+ background: root.background
593+ opacity: 0
594+ visible: opacity > 0
595+
596+ onCloseSpread: priv.goneToSpread = false;
597+ }
598+
566599 Spread {
567600 id: spreadItem
568601 objectName: "spreadItem"
569− anchors.fill: appContainer
602+ anchors { left: parent.left; bottom: parent.bottom; right: parent.right; top: screensAndWorkspaces.bottom }
570603 leftMargin: root.leftMargin
571604 model: root.topLevelSurfaceList
572605 spreadFlickable: floatingFlickable
@@ -575,6 +608,83 @@ FocusScope {
575608 onLeaveSpread: {
576609 priv.goneToSpread = false;
577610 }
611+
612+ FloatingFlickable {
613+ id: floatingFlickable
614+ objectName: "spreadFlickable"
615+ anchors.fill: parent
616+ enabled: false
617+ contentWidth: spreadItem.spreadTotalWidth
618+
619+ function snap(toIndex) {
620+ var delegate = appRepeater.itemAt(toIndex)
621+ var targetContentX = floatingFlickable.contentWidth / spreadItem.totalItemCount * toIndex;
622+ if (targetContentX - floatingFlickable.contentX > spreadItem.rightStackXPos - (spreadItem.spreadItemWidth / 2)) {
623+ var offset = (spreadItem.rightStackXPos - (spreadItem.spreadItemWidth / 2)) - (targetContentX - floatingFlickable.contentX)
624+ snapAnimation.to = floatingFlickable.contentX - offset;
625+ snapAnimation.start();
626+ } else if (targetContentX - floatingFlickable.contentX < spreadItem.leftStackXPos + units.gu(1)) {
627+ var offset = (spreadItem.leftStackXPos + units.gu(1)) - (targetContentX - floatingFlickable.contentX);
628+ snapAnimation.to = floatingFlickable.contentX - offset;
629+ snapAnimation.start();
630+ }
631+ }
632+ UbuntuNumberAnimation {id: snapAnimation; target: floatingFlickable; property: "contentX"}
633+ }
634+
635+ MouseArea {
636+ id: hoverMouseArea
637+ objectName: "hoverMouseArea"
638+ anchors.fill: parent
639+ propagateComposedEvents: true
640+ hoverEnabled: true
641+ enabled: false
642+ visible: enabled
643+
644+ property int scrollAreaWidth: width / 3
645+ property bool progressiveScrollingEnabled: false
646+
647+ onPressed: mouse.accepted = false
648+
649+ onMouseXChanged: {
650+ mouse.accepted = false
651+
652+ if (hoverMouseArea.pressed) {
653+ return;
654+ }
655+
656+ // Find the hovered item and mark it active
657+ for (var i = appRepeater.count - 1; i >= 0; i--) {
658+ var appDelegate = appRepeater.itemAt(i);
659+ var mapped = mapToItem(appDelegate, hoverMouseArea.mouseX, hoverMouseArea.mouseY)
660+ var itemUnder = appDelegate.childAt(mapped.x, mapped.y);
661+ if (itemUnder && (itemUnder.objectName === "dragArea" || itemUnder.objectName === "windowInfoItem" || itemUnder.objectName == "closeMouseArea")) {
662+ spreadItem.highlightedIndex = i;
663+ break;
664+ }
665+ }
666+
667+ if (floatingFlickable.contentWidth > floatingFlickable.width) {
668+ var margins = floatingFlickable.width * 0.05;
669+
670+ if (!progressiveScrollingEnabled && mouseX < floatingFlickable.width - scrollAreaWidth) {
671+ progressiveScrollingEnabled = true
672+ }
673+
674+ // do we need to scroll?
675+ if (mouseX < scrollAreaWidth + margins) {
676+ var progress = Math.min(1, (scrollAreaWidth + margins - mouseX) / (scrollAreaWidth - margins));
677+ var contentX = (1 - progress) * (floatingFlickable.contentWidth - floatingFlickable.width)
678+ floatingFlickable.contentX = Math.max(0, Math.min(floatingFlickable.contentX, contentX))
679+ }
680+ if (mouseX > floatingFlickable.width - scrollAreaWidth && progressiveScrollingEnabled) {
681+ var progress = Math.min(1, (mouseX - (floatingFlickable.width - scrollAreaWidth)) / (scrollAreaWidth - margins))
682+ var contentX = progress * (floatingFlickable.contentWidth - floatingFlickable.width)
683+ floatingFlickable.contentX = Math.min(floatingFlickable.contentWidth - floatingFlickable.width, Math.max(floatingFlickable.contentX, contentX))
684+ }
685+ }
686+ }
687+ }
578688 }
579689
580690 Connections {
@@ -669,10 +779,28 @@ FocusScope {
669779 }
670780 }
671781
782+ MirSurfaceItem {
783+ id: fakeDragItem
784+ property real previewScale: .5
785+ height: (screensAndWorkspaces.height - units.gu(8)) / 2
786+ // w : h = iw : ih
787+ width: implicitWidth * height / implicitHeight
788+ surfaceWidth: -1
789+ surfaceHeight: -1
790+ opacity: surface != null ? 1 : 0
791+ Behavior on opacity { UbuntuNumberAnimation {} }
792+ visible: opacity > 0
793+
794+ Drag.active: surface != null
795+ Drag.keys: ["application"]
796+
797+ z: 1000
798+ }
799+
672800 Item {
673801 id: boundariesForWindowPlacement
674802 anchors.fill: parent
675− anchors.topMargin: PanelState.panelHeight
803+ anchors.topMargin: panelState.panelHeight
676804 visible: false
677805 }
678806
@@ -704,6 +832,9 @@ FocusScope {
704832 }
705833 z: normalZ
706834
835+ opacity: fakeDragItem.surface == model.window.surface && fakeDragItem.Drag.active ? 0 : 1
836+ Behavior on opacity { UbuntuNumberAnimation {} }
837+
707838 // Normally we want x/y where the surface thinks it is. Width/height of our delegate will
708839 // match what the actual surface size is.
709840 // Don't write to those, they will be set by states
@@ -765,7 +896,7 @@ FocusScope {
765896 target: appDelegate
766897 property: "y"
767898 value: appDelegate.requestedY -
768− Math.min(appDelegate.requestedY - PanelState.panelHeight,
899+ Math.min(appDelegate.requestedY - panelState.panelHeight,
769900 Math.max(0, priv.virtualKeyboardHeight - (appContainer.height - (appDelegate.requestedY + appDelegate.height))))
770901 when: root.oskEnabled && appDelegate.focus && (appDelegate.state == "normal" || appDelegate.state == "restored")
771902 && root.inputMethodRect.height > 0
@@ -876,7 +1007,6 @@ FocusScope {
8761007 function claimFocus() {
8771008 if (root.state == "spread") {
8781009 spreadItem.highlightedIndex = index
879− priv.goneToSpread = false;
8801010 }
8811011 if (root.mode == "stagedWithSideStage") {
8821012 if (appDelegate.stage == ApplicationInfoInterface.SideStage && !sideStage.shown) {
@@ -1163,7 +1293,7 @@ FocusScope {
11631293 progress: 0
11641294 targetHeight: spreadItem.stackHeight
11651295 targetX: spreadMaths.targetX
1166− startY: appDelegate.fullscreen ? 0 : PanelState.panelHeight
1296+ startY: appDelegate.fullscreen ? 0 : panelState.panelHeight
11671297 targetY: spreadMaths.targetY
11681298 targetAngle: spreadMaths.targetAngle
11691299 targetScale: spreadMaths.targetScale
@@ -1209,8 +1339,6 @@ FocusScope {
12091339 y: spreadMaths.targetY
12101340 z: index
12111341 height: spreadItem.spreadItemHeight
1212− requestedWidth: decoratedWindow.oldRequestedWidth
1213− requestedHeight: decoratedWindow.oldRequestedHeight
12141342 visible: spreadMaths.itemVisible
12151343 }
12161344 PropertyChanges { target: dragArea; enabled: true }
@@ -1230,8 +1358,6 @@ FocusScope {
12301358 y: stagedRightEdgeMaths.animatedY
12311359 z: stagedRightEdgeMaths.animatedZ
12321360 height: stagedRightEdgeMaths.animatedHeight
1233− requestedWidth: decoratedWindow.oldRequestedWidth
1234− requestedHeight: decoratedWindow.oldRequestedHeight
12351361 visible: appDelegate.x < root.width
12361362 }
12371363 PropertyChanges {
@@ -1261,8 +1387,6 @@ FocusScope {
12611387 y: windowedRightEdgeMaths.animatedY
12621388 z: windowedRightEdgeMaths.animatedZ
12631389 height: stagedRightEdgeMaths.animatedHeight
1264− requestedWidth: decoratedWindow.oldRequestedWidth
1265− requestedHeight: decoratedWindow.oldRequestedHeight
12661390 }
12671391 PropertyChanges {
12681392 target: decoratedWindow
@@ -1284,12 +1408,16 @@ FocusScope {
12841408 PropertyChanges {
12851409 target: appDelegate
12861410 x: stageMaths.itemX
1287− y: appDelegate.fullscreen ? 0 : PanelState.panelHeight
1288− requestedWidth: appContainer.width
1289− requestedHeight: appDelegate.fullscreen ? appContainer.height : appContainer.height - PanelState.panelHeight
1411+ y: appDelegate.fullscreen ? 0 : panelState.panelHeight
12901412 visuallyMaximized: true
12911413 visible: appDelegate.x < root.width
12921414 }
1415+ PropertyChanges {
1416+ target: appDelegate
1417+ requestedWidth: appContainer.width
1418+ requestedHeight: appDelegate.fullscreen ? appContainer.height : appContainer.height - panelState.panelHeight
1419+ restoreEntryValues: false
1420+ }
12931421 PropertyChanges {
12941422 target: decoratedWindow
12951423 hasDecoration: false
@@ -1312,13 +1440,17 @@ FocusScope {
13121440 PropertyChanges {
13131441 target: appDelegate
13141442 x: stageMaths.itemX
1315− y: appDelegate.fullscreen ? 0 : PanelState.panelHeight
1443+ y: appDelegate.fullscreen ? 0 : panelState.panelHeight
13161444 z: stageMaths.itemZ
1317− requestedWidth: stageMaths.itemWidth
1318− requestedHeight: appDelegate.fullscreen ? appContainer.height : appContainer.height - PanelState.panelHeight
13191445 visuallyMaximized: true
13201446 visible: appDelegate.x < root.width
13211447 }
1448+ PropertyChanges {
1449+ target: appDelegate
1450+ requestedWidth: stageMaths.itemWidth
1451+ requestedHeight: appDelegate.fullscreen ? appContainer.height : appContainer.height - panelState.panelHeight
1452+ restoreEntryValues: false
1453+ }
13221454 PropertyChanges {
13231455 target: decoratedWindow
13241456 hasDecoration: false
@@ -1336,8 +1468,12 @@ FocusScope {
13361468 requestedY: 0;
13371469 visuallyMinimized: false;
13381470 visuallyMaximized: true
1339− requestedWidth: appContainer.width - root.leftMargin;
1340− requestedHeight: appContainer.height;
1471+ }
1472+ PropertyChanges {
1473+ target: appDelegate
1474+ requestedWidth: appContainer.width - root.leftMargin
1475+ requestedHeight: appContainer.height
1476+ restoreEntryValues: false
13411477 }
13421478 PropertyChanges { target: touchControls; enabled: true }
13431479 },
@@ -1347,8 +1483,12 @@ FocusScope {
13471483 target: appDelegate;
13481484 requestedX: 0
13491485 requestedY: 0
1350− requestedWidth: appContainer.width;
1351− requestedHeight: appContainer.height;
1486+ }
1487+ PropertyChanges {
1488+ target: appDelegate
1489+ requestedWidth: appContainer.width
1490+ requestedHeight: appContainer.height
1491+ restoreEntryValues: false
13521492 }
13531493 PropertyChanges { target: decoratedWindow; hasDecoration: false }
13541494 },
@@ -1363,6 +1503,12 @@ FocusScope {
13631503 PropertyChanges { target: touchControls; enabled: true }
13641504 PropertyChanges { target: resizeArea; enabled: true }
13651505 PropertyChanges { target: decoratedWindow; shadowOpacity: .3}
1506+ PropertyChanges {
1507+ target: appDelegate
1508+ requestedWidth: windowedWidth
1509+ requestedHeight: windowedHeight
1510+ restoreEntryValues: false
1511+ }
13661512 },
13671513 State {
13681514 name: "restored";
@@ -1380,9 +1526,9 @@ FocusScope {
13801526 PropertyChanges {
13811527 target: appDelegate
13821528 windowedX: root.leftMargin
1383− windowedY: PanelState.panelHeight
1529+ windowedY: panelState.panelHeight
13841530 windowedWidth: (appContainer.width - root.leftMargin)/2
1385− windowedHeight: appContainer.height - PanelState.panelHeight
1531+ windowedHeight: appContainer.height - panelState.panelHeight
13861532 }
13871533 },
13881534 State {
@@ -1399,9 +1545,9 @@ FocusScope {
13991545 PropertyChanges {
14001546 target: appDelegate
14011547 windowedX: root.leftMargin
1402− windowedY: PanelState.panelHeight
1548+ windowedY: panelState.panelHeight
14031549 windowedWidth: (appContainer.width - root.leftMargin)/2
1404− windowedHeight: (appContainer.height - PanelState.panelHeight)/2
1550+ windowedHeight: (appContainer.height - panelState.panelHeight)/2
14051551 }
14061552 },
14071553 State {
@@ -1418,7 +1564,7 @@ FocusScope {
14181564 PropertyChanges {
14191565 target: appDelegate
14201566 windowedX: root.leftMargin
1421− windowedY: (appContainer.height + PanelState.panelHeight)/2
1567+ windowedY: (appContainer.height + panelState.panelHeight)/2
14221568 windowedWidth: (appContainer.width - root.leftMargin)/2
14231569 windowedHeight: appContainer.height/2
14241570 }
@@ -1440,8 +1586,8 @@ FocusScope {
14401586 State {
14411587 name: "maximizedVertically"; when: appDelegate.maximizedVertically && !appDelegate.minimized
14421588 extend: "normal"
1443− PropertyChanges { target: appDelegate; windowedX: windowedX; windowedY: PanelState.panelHeight;
1444− windowedWidth: windowedWidth; windowedHeight: appContainer.height - PanelState.panelHeight }
1589+ PropertyChanges { target: appDelegate; windowedX: windowedX; windowedY: panelState.panelHeight;
1590+ windowedWidth: windowedWidth; windowedHeight: appContainer.height - panelState.panelHeight }
14451591 },
14461592 State {
14471593 name: "minimized"; when: appDelegate.minimized
@@ -1456,6 +1602,10 @@ FocusScope {
14561602 }
14571603 }
14581604 ]
1605+ onStateChanged: {
1606+ print("item", index, "state changed", state)
1607+ }
1608+
14591609 transitions: [
14601610 Transition {
14611611 from: "staged,stagedWithSideStage"
@@ -1469,6 +1619,7 @@ FocusScope {
14691619 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,requestedX,requestedY,requestedWidth,requestedHeight"; duration: priv.animationDuration}
14701620 },
14711621 Transition {
1622+ from: "normal,restored,maximized,maximizedHorizontally,maximizedVertically,maximizedLeft,maximizedRight,maximizedTopLeft,maximizedBottomLeft,maximizedTopRight,maximizedBottomRight,staged,stagedWithSideStage,windowedRightEdge,stagedRightEdge";
14721623 to: "spread"
14731624 // DecoratedWindow wants the scaleToPreviewSize set before enabling scaleToPreview
14741625 PropertyAction { target: appDelegate; properties: "z,visible" }
@@ -1554,7 +1705,7 @@ FocusScope {
15541705 ]
15551706
15561707 Binding {
1557− target: PanelState
1708+ target: panelState
15581709 property: "decorationsAlwaysVisible"
15591710 value: appDelegate && appDelegate.maximized && touchControls.overlayShown
15601711 }
@@ -1575,6 +1726,7 @@ FocusScope {
15751726 borderThickness: units.gu(2)
15761727 enabled: false
15771728 visible: enabled
1729+ readyToAssesBounds: !appDelegate._constructing
15781730
15791731 onPressed: {
15801732 appDelegate.activate();
@@ -1598,16 +1750,11 @@ FocusScope {
15981750 height: implicitHeight
15991751 highlightSize: windowInfoItem.iconMargin / 2
16001752 boundsItem: boundariesForWindowPlacement
1753+ panelState: root.panelState
16011754
16021755 requestedWidth: appDelegate.requestedWidth
16031756 requestedHeight: appDelegate.requestedHeight
16041757
1605− property int oldRequestedWidth: -1
1606− property int oldRequestedHeight: -1
1607−
1608− onRequestedWidthChanged: oldRequestedWidth = requestedWidth
1609− onRequestedHeightChanged: oldRequestedHeight = requestedHeight
1610−
16111758 onCloseClicked: { appDelegate.close(); }
16121759 onMaximizeClicked: {
16131760 if (appDelegate.canBeMaximized) {
@@ -1688,6 +1835,8 @@ FocusScope {
16881835 anchors.fill: decoratedWindow
16891836 enabled: false
16901837 closeable: !appDelegate.isDash
1838+ stage: root
1839+ dragDelegate: fakeDragItem
16911840
16921841 onClicked: {
16931842 spreadItem.highlightedIndex = index;
@@ -1730,12 +1879,15 @@ FocusScope {
17301879 objectName: "closeMouseArea"
17311880 anchors { left: parent.left; top: parent.top; leftMargin: -height / 2; topMargin: -height / 2 + spreadMaths.closeIconOffset }
17321881 readonly property var mousePos: hoverMouseArea.mapToItem(appDelegate, hoverMouseArea.mouseX, hoverMouseArea.mouseY)
1733− visible: !appDelegate.isDash && dragArea.distance == 0
1882+ readonly property bool shown: !appDelegate.isDash && dragArea.distance == 0
17341883 && index == spreadItem.highlightedIndex
17351884 && mousePos.y < (decoratedWindow.height / 3)
17361885 && mousePos.y > -units.gu(4)
17371886 && mousePos.x > -units.gu(4)
17381887 && mousePos.x < (decoratedWindow.width * 2 / 3)
1888+ opacity: shown ? 1 : 0
1889+ visible: opacity > 0
1890+ Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
17391891 height: units.gu(6)
17401892 width: height
17411893
@@ -1797,83 +1949,19 @@ FocusScope {
17971949 leftMargin: root.leftMargin
17981950 appContainerWidth: appContainer.width
17991951 appContainerHeight: appContainer.height
1952+ panelState: root.panelState
18001953 }
18011954
1802− MouseArea {
1803− id: hoverMouseArea
1804− objectName: "hoverMouseArea"
1805− anchors.fill: appContainer
1806− propagateComposedEvents: true
1807− hoverEnabled: true
1808− enabled: false
1809− visible: enabled
1810−
1811− property int scrollAreaWidth: width / 3
1812− property bool progressiveScrollingEnabled: false
1813−
1814− onMouseXChanged: {
1815− mouse.accepted = false
1816−
1817− if (hoverMouseArea.pressed) {
1818− return;
1819− }
1820−
1821− // Find the hovered item and mark it active
1822− for (var i = appRepeater.count - 1; i >= 0; i--) {
1823− var appDelegate = appRepeater.itemAt(i);
1824− var mapped = mapToItem(appDelegate, hoverMouseArea.mouseX, hoverMouseArea.mouseY)
1825− var itemUnder = appDelegate.childAt(mapped.x, mapped.y);
1826− if (itemUnder && (itemUnder.objectName === "dragArea" || itemUnder.objectName === "windowInfoItem" || itemUnder.objectName == "closeMouseArea")) {
1827− spreadItem.highlightedIndex = i;
1828− break;
1829− }
1830− }
1831−
1832− if (floatingFlickable.contentWidth > floatingFlickable.width) {
1833− var margins = floatingFlickable.width * 0.05;
1834−
1835− if (!progressiveScrollingEnabled && mouseX < floatingFlickable.width - scrollAreaWidth) {
1836− progressiveScrollingEnabled = true
1837− }
1838−
1839− // do we need to scroll?
1840− if (mouseX < scrollAreaWidth + margins) {
1841− var progress = Math.min(1, (scrollAreaWidth + margins - mouseX) / (scrollAreaWidth - margins));
1842− var contentX = (1 - progress) * (floatingFlickable.contentWidth - floatingFlickable.width)
1843− floatingFlickable.contentX = Math.max(0, Math.min(floatingFlickable.contentX, contentX))
1844− }
1845− if (mouseX > floatingFlickable.width - scrollAreaWidth && progressiveScrollingEnabled) {
1846− var progress = Math.min(1, (mouseX - (floatingFlickable.width - scrollAreaWidth)) / (scrollAreaWidth - margins))
1847− var contentX = progress * (floatingFlickable.contentWidth - floatingFlickable.width)
1848− floatingFlickable.contentX = Math.min(floatingFlickable.contentWidth - floatingFlickable.width, Math.max(floatingFlickable.contentX, contentX))
1849− }
1850− }
1851− }
1852−
1853− onPressed: mouse.accepted = false
1854− }
1855−
1856− FloatingFlickable {
1857− id: floatingFlickable
1858− objectName: "spreadFlickable"
1859− anchors.fill: appContainer
1860− enabled: false
1861− contentWidth: spreadItem.spreadTotalWidth
1862−
1863− function snap(toIndex) {
1864− var delegate = appRepeater.itemAt(toIndex)
1865− var targetContentX = floatingFlickable.contentWidth / spreadItem.totalItemCount * toIndex;
1866− if (targetContentX - floatingFlickable.contentX > spreadItem.rightStackXPos - (spreadItem.spreadItemWidth / 2)) {
1867− var offset = (spreadItem.rightStackXPos - (spreadItem.spreadItemWidth / 2)) - (targetContentX - floatingFlickable.contentX)
1868− snapAnimation.to = Math.max(0, floatingFlickable.contentX - offset);
1869− snapAnimation.start();
1870− } else if (targetContentX - floatingFlickable.contentX < spreadItem.leftStackXPos + units.gu(1)) {
1871− var offset = (spreadItem.leftStackXPos + units.gu(1)) - (targetContentX - floatingFlickable.contentX);
1872− snapAnimation.to = Math.max(0, floatingFlickable.contentX - offset);
1873− snapAnimation.start();
1955+ WorkspaceSwitcher {
1956+ id: workspaceSwitcher
1957+ anchors.centerIn: parent
1958+ height: units.gu(20)
1959+ background: root.background
1960+ onActiveChanged: {
1961+ if (!active) {
1962+ appContainer.focus = true;
18741963 }
18751964 }
1876− UbuntuNumberAnimation {id: snapAnimation; target: floatingFlickable; property: "contentX"}
18771965 }
18781966
18791967 PropertyAnimation {