on xenial help sign in
don't really activate a workspace just yet when clicking on it
commit545b58b5b21e9965899150b8523ed7a7976f5c46 authorMichael Zanetti <michael.zanetti@canonical.com> dateFri 31 Mar 2017, 18:05 (10 years ago) parent4944c2a
4 files changed+28−4
qml/Shell.qml+2−1 qml/Stage/Spread/ScreensAndWorkspaces.qml+10 qml/Stage/Spread/Workspaces.qml+7−2 qml/Stage/Stage.qml+9−1
qml/Shell.qml+2−1
@@ -99,8 +99,9 @@ StyledItem {
9999
100100 readonly property var topLevelSurfaceList: {
101101 if (!WMScreen.currentWorkspace) return null;
102− return WMScreen.currentWorkspace.windowModel
102+ return stage.temporarySelectedWorkspace ? stage.temporarySelectedWorkspace.windowModel : WMScreen.currentWorkspace.windowModel
103103 }
104+ onTopLevelSurfaceListChanged: print("********************** have new TLSL", topLevelSurfaceList)
104105
105106 onMainAppChanged: {
106107 if (mainApp) {
qml/Stage/Spread/ScreensAndWorkspaces.qml+10
@@ -12,6 +12,10 @@ Item {
1212
1313 property var screensProxy: Screens.createProxy();
1414
15+ property var lastClickedWorkspace: null
16+ property var activeWorkspace: null
17+ onActiveWorkspaceChanged: print("********************* active workspace changed:", activeWorkspace)
18+
1519 signal closeSpread();
1620
1721 Row {
@@ -22,6 +26,7 @@ Item {
2226// anchors.left: parent.left
2327 spacing: units.gu(1)
2428
29+
2530 Repeater {
2631 model: screensProxy
2732
@@ -149,10 +154,15 @@ Item {
149154 background: root.background
150155
151156 workspaceModel: model.screen.workspaces
157+ activeWorkspace: root.activeWorkspace
152158 readOnly: false
153159
154160 onCommitScreenSetup: Screens.sync(root.screensProxy)
155161 onCloseSpread: root.closeSpread();
162+
163+ onClicked: {
164+ root.lastClickedWorkspace = workspace;
165+ }
156166 }
157167 }
158168 }
qml/Stage/Spread/Workspaces.qml+7−2
@@ -17,9 +17,11 @@ Item {
1717 property var background // TODO: should be stored in the workspace data
1818 property int selectedIndex: -1
1919 property bool readOnly: true
20+ property var activeWorkspace: null
2021
2122 signal commitScreenSetup();
2223 signal closeSpread();
24+ signal clicked(var workspace);
2325
2426 DropArea {
2527 anchors.fill: root
@@ -87,6 +89,7 @@ Item {
8789 anchors.margins: -units.gu(2)
8890 clip: true
8991
92+
9093 ListView {
9194 id: listView
9295 anchors {
@@ -102,6 +105,8 @@ Item {
102105 SmoothedAnimation { duration: 200 }
103106 }
104107
108+ property var clickedWorkspace: null
109+
105110 orientation: ListView.Horizontal
106111 spacing: units.gu(1)
107112 leftMargin: itemWidth
@@ -252,14 +257,14 @@ Item {
252257 screenHeight: listView.screenHeight
253258 containsDragLeft: listView.hoveredWorkspaceIndex == index && listView.hoveredHalf == "left"
254259 containsDragRight: listView.hoveredWorkspaceIndex == index && listView.hoveredHalf == "right"
255− isActive: model.workspace.active
260+ isActive: workspace == root.activeWorkspace
256261 isSelected: index === root.selectedIndex
257262 workspace: model.workspace
258263 }
259264 MouseArea {
260265 anchors.fill: parent
261266 onClicked: {
262− model.workspace.activate();
267+ root.clicked(model.workspace)
263268 }
264269 onDoubleClicked: {
265270 model.workspace.activate();
qml/Stage/Stage.qml+9−1
@@ -25,6 +25,7 @@ import GlobalShortcut 1.0
2525import GSettings 1.0
2626import "Spread"
2727import "Spread/MathUtils.js" as MathUtils
28+import WindowManager 1.0
2829
2930FocusScope {
3031 id: root
@@ -49,6 +50,8 @@ FocusScope {
4950 property real rightEdgePushProgress: 0
5051 property PanelState panelState
5152
53+ readonly property var temporarySelectedWorkspace: state == "spread" ? screensAndWorkspaces.lastClickedWorkspace : null
54+
5255 // Configuration
5356 property string mode: "staged"
5457
@@ -522,11 +525,15 @@ FocusScope {
522525 Transition {
523526 from: "stagedRightEdge,sideStagedRightEdge,windowedRightEdge"; to: "spread"
524527 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: -1 }
528+ PropertyAction { target: screensAndWorkspaces; property: "activeWorkspace"; value: WMScreen.currentWorkspace }
529+ ScriptAction { script: { print("blabal***********************", WMScreen.currentWorkspace) } }
525530 PropertyAnimation { target: blurLayer; properties: "brightness,blurRadius"; duration: priv.animationDuration }
526531 UbuntuNumberAnimation { target: screensAndWorkspaces; property: "opacity"; duration: priv.animationDuration }
527532 },
528533 Transition {
529534 to: "spread"
535+ PropertyAction { target: screensAndWorkspaces; property: "activeWorkspace"; value: WMScreen.currentWorkspace }
536+ ScriptAction { script: { print("blabal***********************", WMScreen.currentWorkspace) } }
530537 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: appRepeater.count > 1 ? 1 : 0 }
531538 PropertyAction { target: floatingFlickable; property: "contentX"; value: 0 }
532539 UbuntuNumberAnimation { target: screensAndWorkspaces; property: "opacity"; duration: priv.animationDuration }
@@ -545,6 +552,7 @@ FocusScope {
545552 }
546553 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: -1 }
547554 PropertyAction { target: floatingFlickable; property: "contentX"; value: 0 }
555+ PropertyAction { target: screensAndWorkspaces; property: "lastClickedWorkspace"; value: null }
548556 }
549557 },
550558 Transition {
@@ -594,8 +602,8 @@ FocusScope {
594602 background: root.background
595603 opacity: 0
596604 visible: opacity > 0
597−
598605 onCloseSpread: priv.goneToSpread = false;
606+ onLastClickedWorkspaceChanged: activeWorkspace = lastClickedWorkspace
599607 }
600608
601609 Spread {