@@ -12,8 +12,7 @@ Item {
13 property var screensProxy: Screens.createProxy();
13 property var screensProxy: Screens.createProxy();
15− property var lastClickedWorkspace: null
16− property var activeWorkspace: null
15+ property QtObject activeWorkspace: null
17 onActiveWorkspaceChanged: print("********************* active workspace changed:", activeWorkspace)
16 onActiveWorkspaceChanged: print("********************* active workspace changed:", activeWorkspace)
19 signal closeSpread();
18 signal closeSpread();
@@ -23,9 +22,9 @@ Item {
23 anchors.bottom: parent.bottom
22 anchors.bottom: parent.bottom
24 anchors.horizontalCenter: parent.horizontalCenter
23 anchors.horizontalCenter: parent.horizontalCenter
25 Behavior on anchors.horizontalCenterOffset { NumberAnimation { duration: UbuntuAnimation.SlowDuration } }
24 Behavior on anchors.horizontalCenterOffset { NumberAnimation { duration: UbuntuAnimation.SlowDuration } }
26−// anchors.left: parent.left
27 spacing: units.gu(1)
25 spacing: units.gu(1)
27+ property var selectedIndex: undefined
30 Repeater {
29 Repeater {
31 model: screensProxy
30 model: screensProxy
@@ -34,13 +33,39 @@ Item {
34 height: root.height - units.gu(6)
33 height: root.height - units.gu(6)
35 width: workspaces.width
34 width: workspaces.width
37− UbuntuShape {
36+ Item {
38 id: header
37 id: header
39 anchors { left: parent.left; top: parent.top; right: parent.right }
38 anchors { left: parent.left; top: parent.top; right: parent.right }
40 height: units.gu(7)
39 height: units.gu(7)
41− backgroundColor: "white"
42+ property bool isCurrent: {
43+ // another screen is selected.
44+ if (row.selectedIndex != undefined && row.selectedIndex != index) return false;
46+ // this screen is active.
47+ if (WMScreen.active && WMScreen.isSameAs(model.screen) && WMScreen.currentWorkspace.isSameAs(activeWorkspace)) return true;
48+ if (model.screen.workspaces.indexOf(activeWorkspace) >= 0) return true;
54+ property bool isSelected: screenMA.containsMouse
55+ onIsSelectedChanged: {
57+ row.selectedIndex = Qt.binding(function() { return index; });
58+ } else if (row.selectedIndex === index) {
59+ row.selectedIndex = undefined;
65+ backgroundColor: "white"
66+ opacity: header.isCurrent || header.isSelected ? 1.0 : 0.5
44 DropArea {
69 DropArea {
45 anchors.fill: parent
70 anchors.fill: parent
46 keys: ["workspace"]
71 keys: ["workspace"]
@@ -66,23 +91,38 @@ Item {
68 text: model.screen.name
93 text: model.screen.name
69− color: "black"
94+ color: header.isCurrent || header.isSelected ? "black" : "white"
73 text: model.screen.outputTypeName
98 text: model.screen.outputTypeName
74− color: "black"
99+ color: header.isCurrent || header.isSelected ? "black" : "white"
75 fontSize: "x-small"
100 fontSize: "x-small"
79 text: screen.availableModes[screen.currentModeIndex].size.width + "x" + screen.availableModes[screen.currentModeIndex].size.height
104 text: screen.availableModes[screen.currentModeIndex].size.width + "x" + screen.availableModes[screen.currentModeIndex].size.height
80− color: "black"
105+ color: header.isCurrent || header.isSelected ? "black" : "white"
81 fontSize: "x-small"
106 fontSize: "x-small"
114+ margins: units.gu(1)
118+ source: "image://theme/select"
119+ color: header.isCurrent || header.isSelected ? "black" : "white"
120+ visible: model.screen.active
85 MouseArea {
123 MouseArea {
86 anchors.fill: parent
126 anchors.fill: parent
88 onClicked: {
128 onClicked: {
@@ -161,7 +201,7 @@ Item {
161 onCloseSpread: root.closeSpread();
201 onCloseSpread: root.closeSpread();
163 onClicked: {
203 onClicked: {
164− root.lastClickedWorkspace = workspace;
204+ root.activeWorkspace = workspace;