on xenial help sign in
merge
22d678aMichael Zanetti
qml/Stage/Spread/ScreensAndWorkspaces.qml+49−9
@@ -12,8 +12,7 @@ Item {
12
12
13 property var screensProxy: Screens.createProxy();
13 property var screensProxy: Screens.createProxy();
14
14
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)
18
17
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)
28
26
27+ property var selectedIndex: undefined
29
28
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
36
35
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 z: 1
40 z: 1
43
41
42+ property bool isCurrent: {
43+ // another screen is selected.
44+ if (row.selectedIndex != undefined && row.selectedIndex != index) return false;
45+
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;
49+
50+ // not active.
51+ return false;
52+ }
53+
54+ property bool isSelected: screenMA.containsMouse
55+ onIsSelectedChanged: {
56+ if (isSelected) {
57+ row.selectedIndex = Qt.binding(function() { return index; });
58+ } else if (row.selectedIndex === index) {
59+ row.selectedIndex = undefined;
60+ }
61+ }
62+
63+ UbuntuShape {
64+ anchors.fill: parent
65+ backgroundColor: "white"
66+ opacity: header.isCurrent || header.isSelected ? 1.0 : 0.5
67+ }
68+
44 DropArea {
69 DropArea {
45 anchors.fill: parent
70 anchors.fill: parent
46 keys: ["workspace"]
71 keys: ["workspace"]
@@ -66,23 +91,38 @@ Item {
66
91
67 Label {
92 Label {
68 text: model.screen.name
93 text: model.screen.name
69− color: "black"
94+ color: header.isCurrent || header.isSelected ? "black" : "white"
70 }
95 }
71
96
72 Label {
97 Label {
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"
76 }
101 }
77
102
78 Label {
103 Label {
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"
82 }
107 }
83 }
108 }
84
109
110+ Icon {
111+ anchors {
112+ top: parent.top
113+ right: parent.right
114+ margins: units.gu(1)
115+ }
116+ width: units.gu(3)
117+ height: width
118+ source: "image://theme/select"
119+ color: header.isCurrent || header.isSelected ? "black" : "white"
120+ visible: model.screen.active
121+ }
122+
85 MouseArea {
123 MouseArea {
124+ id: screenMA
125+ hoverEnabled: true
86 anchors.fill: parent
126 anchors.fill: parent
87
127
88 onClicked: {
128 onClicked: {
@@ -161,7 +201,7 @@ Item {
161 onCloseSpread: root.closeSpread();
201 onCloseSpread: root.closeSpread();
162
202
163 onClicked: {
203 onClicked: {
164− root.lastClickedWorkspace = workspace;
204+ root.activeWorkspace = workspace;
165 }
205 }
166 }
206 }
167 }
207 }
qml/Stage/Spread/Workspaces.qml+1−1
@@ -257,7 +257,7 @@ Item {
257 screenHeight: listView.screenHeight
257 screenHeight: listView.screenHeight
258 containsDragLeft: listView.hoveredWorkspaceIndex == index && listView.hoveredHalf == "left"
258 containsDragLeft: listView.hoveredWorkspaceIndex == index && listView.hoveredHalf == "left"
259 containsDragRight: listView.hoveredWorkspaceIndex == index && listView.hoveredHalf == "right"
259 containsDragRight: listView.hoveredWorkspaceIndex == index && listView.hoveredHalf == "right"
260− isActive: workspace == root.activeWorkspace
260+ isActive: workspace.isSameAs(root.activeWorkspace)
261 isSelected: index === root.selectedIndex
261 isSelected: index === root.selectedIndex
262 workspace: model.workspace
262 workspace: model.workspace
263 }
263 }
qml/Stage/Stage.qml+1−3
@@ -50,7 +50,7 @@ FocusScope {
50 property Item availableDesktopArea
50 property Item availableDesktopArea
51 property PanelState panelState
51 property PanelState panelState
52
52
53− readonly property var temporarySelectedWorkspace: state == "spread" ? screensAndWorkspaces.lastClickedWorkspace : null
53+ readonly property var temporarySelectedWorkspace: state == "spread" ? screensAndWorkspaces.activeWorkspace : null
54
54
55 // Configuration
55 // Configuration
56 property string mode: "staged"
56 property string mode: "staged"
@@ -581,7 +581,6 @@ FocusScope {
581 }
581 }
582 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: -1 }
582 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: -1 }
583 PropertyAction { target: floatingFlickable; property: "contentX"; value: 0 }
583 PropertyAction { target: floatingFlickable; property: "contentX"; value: 0 }
584− PropertyAction { target: screensAndWorkspaces; property: "lastClickedWorkspace"; value: null }
585 }
584 }
586 },
585 },
587 Transition {
586 Transition {
@@ -632,7 +631,6 @@ FocusScope {
632 opacity: 0
631 opacity: 0
633 visible: opacity > 0
632 visible: opacity > 0
634 onCloseSpread: priv.goneToSpread = false;
633 onCloseSpread: priv.goneToSpread = false;
635− onLastClickedWorkspaceChanged: activeWorkspace = lastClickedWorkspace
636 }
634 }
637
635
638 Spread {
636 Spread {