@@ -25,6 +25,7 @@ import GlobalShortcut 1.0
25import GSettings 1.0
25import GSettings 1.0
26import "Spread"
26import "Spread"
27import "Spread/MathUtils.js" as MathUtils
27import "Spread/MathUtils.js" as MathUtils
28+import WindowManager 1.0
29FocusScope {
30FocusScope {
@@ -47,6 +48,9 @@ FocusScope {
47 property bool oskEnabled: false
48 property bool oskEnabled: false
48 property rect inputMethodRect
49 property rect inputMethodRect
49 property real rightEdgePushProgress: 0
50 property real rightEdgePushProgress: 0
51+ property PanelState panelState
53+ readonly property var temporarySelectedWorkspace: state == "spread" ? screensAndWorkspaces.lastClickedWorkspace : null
51 // Configuration
55 // Configuration
52 property string mode: "staged"
56 property string mode: "staged"
@@ -224,6 +228,25 @@ FocusScope {
224 active: priv.focusedAppDelegate !== null
228 active: priv.focusedAppDelegate !== null
232+ id: showWorkspaceSwitcherShortcutLeft
233+ shortcut: Qt.AltModifier|Qt.ControlModifier|Qt.Key_Left
234+ active: !workspaceSwitcher.active
237+ workspaceSwitcher.showLeft()
241+ id: showWorkspaceSwitcherShortcutRight
242+ shortcut: Qt.AltModifier|Qt.ControlModifier|Qt.Key_Right
243+ active: !workspaceSwitcher.active
246+ workspaceSwitcher.showRight()
227 QtObject {
250 QtObject {
229 objectName: "DesktopStagePrivate"
252 objectName: "DesktopStagePrivate"
@@ -349,23 +372,23 @@ FocusScope {
349 readonly property real virtualKeyboardHeight: root.inputMethodRect.height
372 readonly property real virtualKeyboardHeight: root.inputMethodRect.height
352− Component.onCompleted: priv.updateMainAndSideStageIndexes();
375+ Component.onCompleted: priv.updateMainAndSideStageIndexes()
354 Connections {
377 Connections {
355− target: PanelState
378+ target: panelState
356 onCloseClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.close(); } }
379 onCloseClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.close(); } }
357 onMinimizeClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.requestMinimize(); } }
380 onMinimizeClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.requestMinimize(); } }
358 onRestoreClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.requestRestore(); } }
381 onRestoreClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.requestRestore(); } }
361 Binding {
384 Binding {
362− target: PanelState
385+ target: panelState
363 property: "decorationsVisible"
386 property: "decorationsVisible"
364 value: priv.focusedAppDelegate !== null && priv.focusedAppDelegate.maximized // FIXME for Locally integrated menus
387 value: priv.focusedAppDelegate !== null && priv.focusedAppDelegate.maximized // FIXME for Locally integrated menus
367 Binding {
390 Binding {
368− target: PanelState
391+ target: panelState
369 property: "title"
392 property: "title"
371 if (priv.focusedAppDelegate !== null) {
394 if (priv.focusedAppDelegate !== null) {
@@ -380,7 +403,7 @@ FocusScope {
382 Binding {
405 Binding {
383− target: PanelState
406+ target: panelState
384 property: "focusedPersistentSurfaceId"
407 property: "focusedPersistentSurfaceId"
386 if (priv.focusedAppDelegate !== null) {
409 if (priv.focusedAppDelegate !== null) {
@@ -394,21 +417,21 @@ FocusScope {
396 Binding {
419 Binding {
397− target: PanelState
420+ target: panelState
398 property: "dropShadow"
421 property: "dropShadow"
399 value: priv.focusedAppDelegate && !priv.focusedAppDelegate.maximized && priv.foregroundMaximizedAppDelegate !== null && mode == "windowed"
422 value: priv.focusedAppDelegate && !priv.focusedAppDelegate.maximized && priv.foregroundMaximizedAppDelegate !== null && mode == "windowed"
402 Binding {
425 Binding {
403− target: PanelState
426+ target: panelState
404 property: "closeButtonShown"
427 property: "closeButtonShown"
405 value: priv.focusedAppDelegate && priv.focusedAppDelegate.maximized && !priv.focusedAppDelegate.isDash
428 value: priv.focusedAppDelegate && priv.focusedAppDelegate.maximized && !priv.focusedAppDelegate.isDash
408 Component.onDestruction: {
431 Component.onDestruction: {
409− PanelState.title = "";
432+ panelState.title = "";
410− PanelState.decorationsVisible = false;
433+ panelState.decorationsVisible = false;
411− PanelState.dropShadow = false;
434+ panelState.dropShadow = false;
414 Instantiator {
437 Instantiator {
@@ -454,6 +477,7 @@ FocusScope {
454 PropertyChanges { target: cancelSpreadMouseArea; enabled: true }
477 PropertyChanges { target: cancelSpreadMouseArea; enabled: true }
455 PropertyChanges { target: blurLayer; visible: true; blurRadius: 32; brightness: .65; opacity: 1 }
478 PropertyChanges { target: blurLayer; visible: true; blurRadius: 32; brightness: .65; opacity: 1 }
456 PropertyChanges { target: wallpaper; visible: false }
479 PropertyChanges { target: wallpaper; visible: false }
480+ PropertyChanges { target: screensAndWorkspaces; opacity: 1 }
459 name: "stagedRightEdge"; when: root.spreadEnabled && (rightEdgeDragArea.dragging || rightEdgePushProgress > 0) && root.mode == "staged"
483 name: "stagedRightEdge"; when: root.spreadEnabled && (rightEdgeDragArea.dragging || rightEdgePushProgress > 0) && root.mode == "staged"
@@ -501,11 +525,18 @@ FocusScope {
501 Transition {
525 Transition {
502 from: "stagedRightEdge,sideStagedRightEdge,windowedRightEdge"; to: "spread"
526 from: "stagedRightEdge,sideStagedRightEdge,windowedRightEdge"; to: "spread"
503 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: -1 }
527 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: -1 }
528+ PropertyAction { target: screensAndWorkspaces; property: "activeWorkspace"; value: WMScreen.currentWorkspace }
529+ ScriptAction { script: { print("blabal***********************", WMScreen.currentWorkspace) } }
504 PropertyAnimation { target: blurLayer; properties: "brightness,blurRadius"; duration: priv.animationDuration }
530 PropertyAnimation { target: blurLayer; properties: "brightness,blurRadius"; duration: priv.animationDuration }
531+ UbuntuNumberAnimation { target: screensAndWorkspaces; property: "opacity"; duration: priv.animationDuration }
506 Transition {
533 Transition {
507 to: "spread"
534 to: "spread"
535+ PropertyAction { target: screensAndWorkspaces; property: "activeWorkspace"; value: WMScreen.currentWorkspace }
536+ ScriptAction { script: { print("blabal***********************", WMScreen.currentWorkspace) } }
508 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: appRepeater.count > 1 ? 1 : 0 }
537 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: appRepeater.count > 1 ? 1 : 0 }
538+ PropertyAction { target: floatingFlickable; property: "contentX"; value: 0 }
539+ UbuntuNumberAnimation { target: screensAndWorkspaces; property: "opacity"; duration: priv.animationDuration }
510 Transition {
541 Transition {
511 from: "spread"
542 from: "spread"
@@ -521,6 +552,7 @@ FocusScope {
522 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: -1 }
553 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: -1 }
523 PropertyAction { target: floatingFlickable; property: "contentX"; value: 0 }
554 PropertyAction { target: floatingFlickable; property: "contentX"; value: 0 }
555+ PropertyAction { target: screensAndWorkspaces; property: "lastClickedWorkspace"; value: null }
526 Transition {
558 Transition {
@@ -563,10 +595,21 @@ FocusScope {
563 visible: false
595 visible: false
598+ ScreensAndWorkspaces {
599+ id: screensAndWorkspaces
600+ anchors { left: parent.left; top: parent.top; right: parent.right; leftMargin: root.leftMargin }
601+ height: Math.max(units.gu(30), parent.height * .3)
602+ background: root.background
604+ visible: opacity > 0
605+ onCloseSpread: priv.goneToSpread = false;
606+ onLastClickedWorkspaceChanged: activeWorkspace = lastClickedWorkspace
567 id: spreadItem
610 id: spreadItem
568 objectName: "spreadItem"
611 objectName: "spreadItem"
569− anchors.fill: appContainer
612+ anchors { left: parent.left; bottom: parent.bottom; right: parent.right; top: screensAndWorkspaces.bottom }
570 leftMargin: root.leftMargin
613 leftMargin: root.leftMargin
571 model: root.topLevelSurfaceList
614 model: root.topLevelSurfaceList
572 spreadFlickable: floatingFlickable
615 spreadFlickable: floatingFlickable
@@ -581,6 +624,83 @@ FocusScope {
581 appRepeater.itemAt(highlightedIndex).close();
624 appRepeater.itemAt(highlightedIndex).close();
629+ id: floatingFlickable
630+ objectName: "spreadFlickable"
631+ anchors.fill: parent
633+ contentWidth: spreadItem.spreadTotalWidth
635+ function snap(toIndex) {
636+ var delegate = appRepeater.itemAt(toIndex)
637+ var targetContentX = floatingFlickable.contentWidth / spreadItem.totalItemCount * toIndex;
638+ if (targetContentX - floatingFlickable.contentX > spreadItem.rightStackXPos - (spreadItem.spreadItemWidth / 2)) {
639+ var offset = (spreadItem.rightStackXPos - (spreadItem.spreadItemWidth / 2)) - (targetContentX - floatingFlickable.contentX)
640+ snapAnimation.to = floatingFlickable.contentX - offset;
641+ snapAnimation.start();
642+ } else if (targetContentX - floatingFlickable.contentX < spreadItem.leftStackXPos + units.gu(1)) {
643+ var offset = (spreadItem.leftStackXPos + units.gu(1)) - (targetContentX - floatingFlickable.contentX);
644+ snapAnimation.to = floatingFlickable.contentX - offset;
645+ snapAnimation.start();
648+ UbuntuNumberAnimation {id: snapAnimation; target: floatingFlickable; property: "contentX"}
653+ objectName: "hoverMouseArea"
654+ anchors.fill: parent
655+ propagateComposedEvents: true
660+ property int scrollAreaWidth: width / 3
661+ property bool progressiveScrollingEnabled: false
663+ onPressed: mouse.accepted = false
666+ mouse.accepted = false
668+ if (hoverMouseArea.pressed) {
672+ // Find the hovered item and mark it active
673+ for (var i = appRepeater.count - 1; i >= 0; i--) {
674+ var appDelegate = appRepeater.itemAt(i);
675+ var mapped = mapToItem(appDelegate, hoverMouseArea.mouseX, hoverMouseArea.mouseY)
676+ var itemUnder = appDelegate.childAt(mapped.x, mapped.y);
677+ if (itemUnder && (itemUnder.objectName === "dragArea" || itemUnder.objectName === "windowInfoItem" || itemUnder.objectName == "closeMouseArea")) {
678+ spreadItem.highlightedIndex = i;
683+ if (floatingFlickable.contentWidth > floatingFlickable.width) {
684+ var margins = floatingFlickable.width * 0.05;
686+ if (!progressiveScrollingEnabled && mouseX < floatingFlickable.width - scrollAreaWidth) {
687+ progressiveScrollingEnabled = true
690+ // do we need to scroll?
691+ if (mouseX < scrollAreaWidth + margins) {
692+ var progress = Math.min(1, (scrollAreaWidth + margins - mouseX) / (scrollAreaWidth - margins));
693+ var contentX = (1 - progress) * (floatingFlickable.contentWidth - floatingFlickable.width)
694+ floatingFlickable.contentX = Math.max(0, Math.min(floatingFlickable.contentX, contentX))
696+ if (mouseX > floatingFlickable.width - scrollAreaWidth && progressiveScrollingEnabled) {
697+ var progress = Math.min(1, (mouseX - (floatingFlickable.width - scrollAreaWidth)) / (scrollAreaWidth - margins))
698+ var contentX = progress * (floatingFlickable.contentWidth - floatingFlickable.width)
699+ floatingFlickable.contentX = Math.min(floatingFlickable.contentWidth - floatingFlickable.width, Math.max(floatingFlickable.contentX, contentX))
586 Connections {
706 Connections {
@@ -675,10 +795,28 @@ FocusScope {
800+ property real previewScale: .5
801+ height: (screensAndWorkspaces.height - units.gu(8)) / 2
803+ width: implicitWidth * height / implicitHeight
806+ opacity: surface != null ? 1 : 0
807+ Behavior on opacity { UbuntuNumberAnimation {} }
808+ visible: opacity > 0
810+ Drag.active: surface != null
811+ Drag.keys: ["application"]
679 id: boundariesForWindowPlacement
817 id: boundariesForWindowPlacement
680 anchors.fill: parent
818 anchors.fill: parent
681− anchors.topMargin: PanelState.panelHeight
819+ anchors.topMargin: panelState.panelHeight
682 visible: false
820 visible: false
@@ -710,6 +848,9 @@ FocusScope {
711 z: normalZ
849 z: normalZ
851+ opacity: fakeDragItem.surface == model.window.surface && fakeDragItem.Drag.active ? 0 : 1
852+ Behavior on opacity { UbuntuNumberAnimation {} }
713 // Normally we want x/y where the surface thinks it is. Width/height of our delegate will
854 // Normally we want x/y where the surface thinks it is. Width/height of our delegate will
714 // match what the actual surface size is.
855 // match what the actual surface size is.
715 // Don't write to those, they will be set by states
856 // Don't write to those, they will be set by states
@@ -779,7 +920,7 @@ FocusScope {
779 target: appDelegate
920 target: appDelegate
780 property: "y"
921 property: "y"
781 value: appDelegate.requestedY -
922 value: appDelegate.requestedY -
782− Math.min(appDelegate.requestedY - PanelState.panelHeight,
923+ Math.min(appDelegate.requestedY - panelState.panelHeight,
783 Math.max(0, priv.virtualKeyboardHeight - (appContainer.height - (appDelegate.requestedY + appDelegate.height))))
924 Math.max(0, priv.virtualKeyboardHeight - (appContainer.height - (appDelegate.requestedY + appDelegate.height))))
784 when: root.oskEnabled && appDelegate.focus && (appDelegate.state == "normal" || appDelegate.state == "restored")
925 when: root.oskEnabled && appDelegate.focus && (appDelegate.state == "normal" || appDelegate.state == "restored")
785 && root.inputMethodRect.height > 0
926 && root.inputMethodRect.height > 0
@@ -890,7 +1031,6 @@ FocusScope {
890 function claimFocus() {
1031 function claimFocus() {
891 if (root.state == "spread") {
1032 if (root.state == "spread") {
892 spreadItem.highlightedIndex = index
1033 spreadItem.highlightedIndex = index
893− priv.goneToSpread = false;
895 if (root.mode == "stagedWithSideStage") {
1035 if (root.mode == "stagedWithSideStage") {
896 if (appDelegate.stage == ApplicationInfoInterface.SideStage && !sideStage.shown) {
1036 if (appDelegate.stage == ApplicationInfoInterface.SideStage && !sideStage.shown) {
@@ -1177,7 +1317,7 @@ FocusScope {
1177 progress: 0
1317 progress: 0
1178 targetHeight: spreadItem.stackHeight
1318 targetHeight: spreadItem.stackHeight
1179 targetX: spreadMaths.targetX
1319 targetX: spreadMaths.targetX
1180− startY: appDelegate.fullscreen ? 0 : PanelState.panelHeight
1320+ startY: appDelegate.fullscreen ? 0 : panelState.panelHeight
1181 targetY: spreadMaths.targetY
1321 targetY: spreadMaths.targetY
1182 targetAngle: spreadMaths.targetAngle
1322 targetAngle: spreadMaths.targetAngle
1183 targetScale: spreadMaths.targetScale
1323 targetScale: spreadMaths.targetScale
@@ -1223,8 +1363,6 @@ FocusScope {
1223 y: spreadMaths.targetY
1363 y: spreadMaths.targetY
1224 z: index
1364 z: index
1225 height: spreadItem.spreadItemHeight
1365 height: spreadItem.spreadItemHeight
1226− requestedWidth: decoratedWindow.oldRequestedWidth
1227− requestedHeight: decoratedWindow.oldRequestedHeight
1228 visible: spreadMaths.itemVisible
1366 visible: spreadMaths.itemVisible
1230 PropertyChanges { target: dragArea; enabled: true }
1368 PropertyChanges { target: dragArea; enabled: true }
@@ -1244,8 +1382,6 @@ FocusScope {
1244 y: stagedRightEdgeMaths.animatedY
1382 y: stagedRightEdgeMaths.animatedY
1245 z: stagedRightEdgeMaths.animatedZ
1383 z: stagedRightEdgeMaths.animatedZ
1246 height: stagedRightEdgeMaths.animatedHeight
1384 height: stagedRightEdgeMaths.animatedHeight
1247− requestedWidth: decoratedWindow.oldRequestedWidth
1248− requestedHeight: decoratedWindow.oldRequestedHeight
1249 visible: appDelegate.x < root.width
1385 visible: appDelegate.x < root.width
1251 PropertyChanges {
1387 PropertyChanges {
@@ -1275,8 +1411,6 @@ FocusScope {
1275 y: windowedRightEdgeMaths.animatedY
1411 y: windowedRightEdgeMaths.animatedY
1276 z: windowedRightEdgeMaths.animatedZ
1412 z: windowedRightEdgeMaths.animatedZ
1277 height: stagedRightEdgeMaths.animatedHeight
1413 height: stagedRightEdgeMaths.animatedHeight
1278− requestedWidth: decoratedWindow.oldRequestedWidth
1279− requestedHeight: decoratedWindow.oldRequestedHeight
1281 PropertyChanges {
1415 PropertyChanges {
1282 target: decoratedWindow
1416 target: decoratedWindow
@@ -1298,12 +1432,16 @@ FocusScope {
1298 PropertyChanges {
1432 PropertyChanges {
1299 target: appDelegate
1433 target: appDelegate
1300 x: stageMaths.itemX
1434 x: stageMaths.itemX
1301− y: appDelegate.fullscreen ? 0 : PanelState.panelHeight
1435+ y: appDelegate.fullscreen ? 0 : panelState.panelHeight
1302− requestedWidth: appContainer.width
1303− requestedHeight: appDelegate.fullscreen ? appContainer.height : appContainer.height - PanelState.panelHeight
1304 visuallyMaximized: true
1436 visuallyMaximized: true
1305 visible: appDelegate.x < root.width
1437 visible: appDelegate.x < root.width
1440+ target: appDelegate
1441+ requestedWidth: appContainer.width
1442+ requestedHeight: appDelegate.fullscreen ? appContainer.height : appContainer.height - panelState.panelHeight
1443+ restoreEntryValues: false
1307 PropertyChanges {
1445 PropertyChanges {
1308 target: decoratedWindow
1446 target: decoratedWindow
1309 hasDecoration: false
1447 hasDecoration: false
@@ -1330,13 +1468,17 @@ FocusScope {
1330 PropertyChanges {
1468 PropertyChanges {
1331 target: appDelegate
1469 target: appDelegate
1332 x: stageMaths.itemX
1470 x: stageMaths.itemX
1333− y: appDelegate.fullscreen ? 0 : PanelState.panelHeight
1471+ y: appDelegate.fullscreen ? 0 : panelState.panelHeight
1334 z: stageMaths.itemZ
1472 z: stageMaths.itemZ
1335− requestedWidth: stageMaths.itemWidth
1336− requestedHeight: appDelegate.fullscreen ? appContainer.height : appContainer.height - PanelState.panelHeight
1337 visuallyMaximized: true
1473 visuallyMaximized: true
1338 visible: appDelegate.x < root.width
1474 visible: appDelegate.x < root.width
1477+ target: appDelegate
1478+ requestedWidth: stageMaths.itemWidth
1479+ requestedHeight: appDelegate.fullscreen ? appContainer.height : appContainer.height - panelState.panelHeight
1480+ restoreEntryValues: false
1340 PropertyChanges {
1482 PropertyChanges {
1341 target: decoratedWindow
1483 target: decoratedWindow
1342 hasDecoration: false
1484 hasDecoration: false
@@ -1358,8 +1500,12 @@ FocusScope {
1358 requestedY: 0;
1500 requestedY: 0;
1359 visuallyMinimized: false;
1501 visuallyMinimized: false;
1360 visuallyMaximized: true
1502 visuallyMaximized: true
1505+ target: appDelegate
1361− requestedWidth: appContainer.width - root.leftMargin;
1506+ requestedWidth: appContainer.width - root.leftMargin
1362− requestedHeight: appContainer.height;
1507+ requestedHeight: appContainer.height
1508+ restoreEntryValues: false
1364 PropertyChanges { target: touchControls; enabled: true }
1510 PropertyChanges { target: touchControls; enabled: true }
@@ -1369,8 +1515,12 @@ FocusScope {
1369 target: appDelegate;
1515 target: appDelegate;
1370 requestedX: 0
1516 requestedX: 0
1371 requestedY: 0
1517 requestedY: 0
1520+ target: appDelegate
1372− requestedWidth: appContainer.width;
1521+ requestedWidth: appContainer.width
1373− requestedHeight: appContainer.height;
1522+ requestedHeight: appContainer.height
1523+ restoreEntryValues: false
1375 PropertyChanges { target: decoratedWindow; hasDecoration: false }
1525 PropertyChanges { target: decoratedWindow; hasDecoration: false }
@@ -1385,6 +1535,12 @@ FocusScope {
1385 PropertyChanges { target: touchControls; enabled: true }
1535 PropertyChanges { target: touchControls; enabled: true }
1386 PropertyChanges { target: resizeArea; enabled: true }
1536 PropertyChanges { target: resizeArea; enabled: true }
1387 PropertyChanges { target: decoratedWindow; shadowOpacity: .3}
1537 PropertyChanges { target: decoratedWindow; shadowOpacity: .3}
1539+ target: appDelegate
1540+ requestedWidth: windowedWidth
1541+ requestedHeight: windowedHeight
1542+ restoreEntryValues: false
1390 name: "restored";
1546 name: "restored";
@@ -1402,9 +1558,9 @@ FocusScope {
1402 PropertyChanges {
1558 PropertyChanges {
1403 target: appDelegate
1559 target: appDelegate
1404 windowedX: root.leftMargin
1560 windowedX: root.leftMargin
1405− windowedY: PanelState.panelHeight
1561+ windowedY: panelState.panelHeight
1406 windowedWidth: (appContainer.width - root.leftMargin)/2
1562 windowedWidth: (appContainer.width - root.leftMargin)/2
1407− windowedHeight: appContainer.height - PanelState.panelHeight
1563+ windowedHeight: appContainer.height - panelState.panelHeight
@@ -1421,9 +1577,9 @@ FocusScope {
1421 PropertyChanges {
1577 PropertyChanges {
1422 target: appDelegate
1578 target: appDelegate
1423 windowedX: root.leftMargin
1579 windowedX: root.leftMargin
1424− windowedY: PanelState.panelHeight
1580+ windowedY: panelState.panelHeight
1425 windowedWidth: (appContainer.width - root.leftMargin)/2
1581 windowedWidth: (appContainer.width - root.leftMargin)/2
1426− windowedHeight: (appContainer.height - PanelState.panelHeight)/2
1582+ windowedHeight: (appContainer.height - panelState.panelHeight)/2
@@ -1440,7 +1596,7 @@ FocusScope {
1440 PropertyChanges {
1596 PropertyChanges {
1441 target: appDelegate
1597 target: appDelegate
1442 windowedX: root.leftMargin
1598 windowedX: root.leftMargin
1443− windowedY: (appContainer.height + PanelState.panelHeight)/2
1599+ windowedY: (appContainer.height + panelState.panelHeight)/2
1444 windowedWidth: (appContainer.width - root.leftMargin)/2
1600 windowedWidth: (appContainer.width - root.leftMargin)/2
1445 windowedHeight: appContainer.height/2
1601 windowedHeight: appContainer.height/2
@@ -1462,8 +1618,8 @@ FocusScope {
1463 name: "maximizedVertically"; when: appDelegate.maximizedVertically && !appDelegate.minimized
1619 name: "maximizedVertically"; when: appDelegate.maximizedVertically && !appDelegate.minimized
1464 extend: "normal"
1620 extend: "normal"
1465− PropertyChanges { target: appDelegate; windowedX: windowedX; windowedY: PanelState.panelHeight;
1621+ PropertyChanges { target: appDelegate; windowedX: windowedX; windowedY: panelState.panelHeight;
1466− windowedWidth: windowedWidth; windowedHeight: appContainer.height - PanelState.panelHeight }
1622+ windowedWidth: windowedWidth; windowedHeight: appContainer.height - panelState.panelHeight }
1469 name: "minimized"; when: appDelegate.minimized
1625 name: "minimized"; when: appDelegate.minimized
@@ -1478,6 +1634,10 @@ FocusScope {
1638+ print("item", index, "state changed", state)
1481 transitions: [
1641 transitions: [
1482 Transition {
1642 Transition {
1483 from: "staged,stagedWithSideStage"
1643 from: "staged,stagedWithSideStage"
@@ -1491,6 +1651,7 @@ FocusScope {
1491 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,requestedX,requestedY,requestedWidth,requestedHeight"; duration: priv.animationDuration}
1651 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,requestedX,requestedY,requestedWidth,requestedHeight"; duration: priv.animationDuration}
1493 Transition {
1653 Transition {
1654+ from: "normal,restored,maximized,maximizedHorizontally,maximizedVertically,maximizedLeft,maximizedRight,maximizedTopLeft,maximizedBottomLeft,maximizedTopRight,maximizedBottomRight,staged,stagedWithSideStage,windowedRightEdge,stagedRightEdge";
1494 to: "spread"
1655 to: "spread"
1495 // DecoratedWindow wants the scaleToPreviewSize set before enabling scaleToPreview
1656 // DecoratedWindow wants the scaleToPreviewSize set before enabling scaleToPreview
1496 PropertyAction { target: appDelegate; properties: "z,visible" }
1657 PropertyAction { target: appDelegate; properties: "z,visible" }
@@ -1576,7 +1737,7 @@ FocusScope {
1578 Binding {
1739 Binding {
1579− target: PanelState
1740+ target: panelState
1580 property: "decorationsAlwaysVisible"
1741 property: "decorationsAlwaysVisible"
1581 value: appDelegate && appDelegate.maximized && touchControls.overlayShown
1742 value: appDelegate && appDelegate.maximized && touchControls.overlayShown
@@ -1597,6 +1758,7 @@ FocusScope {
1597 borderThickness: units.gu(2)
1758 borderThickness: units.gu(2)
1598 enabled: false
1759 enabled: false
1599 visible: enabled
1760 visible: enabled
1761+ readyToAssesBounds: !appDelegate._constructing
1601 onPressed: {
1763 onPressed: {
1602 appDelegate.activate();
1764 appDelegate.activate();
@@ -1620,17 +1782,12 @@ FocusScope {
1620 height: implicitHeight
1782 height: implicitHeight
1621 highlightSize: windowInfoItem.iconMargin / 2
1783 highlightSize: windowInfoItem.iconMargin / 2
1622 boundsItem: boundariesForWindowPlacement
1784 boundsItem: boundariesForWindowPlacement
1785+ panelState: root.panelState
1623 altDragEnabled: root.mode == "windowed"
1786 altDragEnabled: root.mode == "windowed"
1625 requestedWidth: appDelegate.requestedWidth
1788 requestedWidth: appDelegate.requestedWidth
1626 requestedHeight: appDelegate.requestedHeight
1789 requestedHeight: appDelegate.requestedHeight
1628− property int oldRequestedWidth: -1
1629− property int oldRequestedHeight: -1
1631− onRequestedWidthChanged: oldRequestedWidth = requestedWidth
1632− onRequestedHeightChanged: oldRequestedHeight = requestedHeight
1634 onCloseClicked: { appDelegate.close(); }
1791 onCloseClicked: { appDelegate.close(); }
1635 onMaximizeClicked: {
1792 onMaximizeClicked: {
1636 if (appDelegate.canBeMaximized) {
1793 if (appDelegate.canBeMaximized) {
@@ -1711,6 +1868,8 @@ FocusScope {
1711 anchors.fill: decoratedWindow
1868 anchors.fill: decoratedWindow
1712 enabled: false
1869 enabled: false
1713 closeable: !appDelegate.isDash
1870 closeable: !appDelegate.isDash
1872+ dragDelegate: fakeDragItem
1715 onClicked: {
1874 onClicked: {
1716 spreadItem.highlightedIndex = index;
1875 spreadItem.highlightedIndex = index;
@@ -1753,12 +1912,15 @@ FocusScope {
1753 objectName: "closeMouseArea"
1912 objectName: "closeMouseArea"
1754 anchors { left: parent.left; top: parent.top; leftMargin: -height / 2; topMargin: -height / 2 + spreadMaths.closeIconOffset }
1913 anchors { left: parent.left; top: parent.top; leftMargin: -height / 2; topMargin: -height / 2 + spreadMaths.closeIconOffset }
1755 readonly property var mousePos: hoverMouseArea.mapToItem(appDelegate, hoverMouseArea.mouseX, hoverMouseArea.mouseY)
1914 readonly property var mousePos: hoverMouseArea.mapToItem(appDelegate, hoverMouseArea.mouseX, hoverMouseArea.mouseY)
1756− visible: !appDelegate.isDash && dragArea.distance == 0
1915+ readonly property bool shown: !appDelegate.isDash && dragArea.distance == 0
1757 && index == spreadItem.highlightedIndex
1916 && index == spreadItem.highlightedIndex
1758 && mousePos.y < (decoratedWindow.height / 3)
1917 && mousePos.y < (decoratedWindow.height / 3)
1759 && mousePos.y > -units.gu(4)
1918 && mousePos.y > -units.gu(4)
1760 && mousePos.x > -units.gu(4)
1919 && mousePos.x > -units.gu(4)
1761 && mousePos.x < (decoratedWindow.width * 2 / 3)
1920 && mousePos.x < (decoratedWindow.width * 2 / 3)
1921+ opacity: shown ? 1 : 0
1922+ visible: opacity > 0
1923+ Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
1762 height: units.gu(6)
1924 height: units.gu(6)
1763 width: height
1925 width: height
@@ -1820,83 +1982,19 @@ FocusScope {
1820 leftMargin: root.leftMargin
1982 leftMargin: root.leftMargin
1821 appContainerWidth: appContainer.width
1983 appContainerWidth: appContainer.width
1822 appContainerHeight: appContainer.height
1984 appContainerHeight: appContainer.height
1985+ panelState: root.panelState
1825− MouseArea {
1988+ WorkspaceSwitcher {
1826− id: hoverMouseArea
1989+ id: workspaceSwitcher
1827− objectName: "hoverMouseArea"
1990+ anchors.centerIn: parent
1828− anchors.fill: appContainer
1991+ height: units.gu(20)
1829− propagateComposedEvents: true
1992+ background: root.background
1830− hoverEnabled: true
1993+ onActiveChanged: {
1831− enabled: false
1994+ if (!active) {
1832− visible: enabled
1995+ appContainer.focus = true;
1834− property int scrollAreaWidth: width / 3
1835− property bool progressiveScrollingEnabled: false
1838− mouse.accepted = false
1840− if (hoverMouseArea.pressed) {
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;
1855− if (floatingFlickable.contentWidth > floatingFlickable.width) {
1856− var margins = floatingFlickable.width * 0.05;
1858− if (!progressiveScrollingEnabled && mouseX < floatingFlickable.width - scrollAreaWidth) {
1859− progressiveScrollingEnabled = true
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))
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))
1876− onPressed: mouse.accepted = false
1879− FloatingFlickable {
1880− id: floatingFlickable
1881− objectName: "spreadFlickable"
1882− anchors.fill: appContainer
1884− contentWidth: spreadItem.spreadTotalWidth
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();
1899− UbuntuNumberAnimation {id: snapAnimation; target: floatingFlickable; property: "contentX"}
1902 PropertyAnimation {
2000 PropertyAnimation {