@@ -8,7 +8,7 @@ UbuntuShape {
8 id: previewSpace
8 id: previewSpace
10 // Set the height. this preview will then automatically adjust the width, keeping aspect ratio of the screen
10 // Set the height. this preview will then automatically adjust the width, keeping aspect ratio of the screen
11− width: model.geometry.width * previewScale
11+ width: model.geometry.width * previewScale * 4
12 color: "white"
12 color: "white"
13 property string background
13 property string background
@@ -20,6 +20,7 @@ UbuntuShape {
20 id: header
20 id: header
21 anchors { left: parent.left; top: parent.top; right: parent.right }
21 anchors { left: parent.left; top: parent.top; right: parent.right }
22 height: units.gu(7)
22 height: units.gu(7)
24 anchors.fill: parent
25 anchors.fill: parent
25 anchors.margins: units.gu(1)
26 anchors.margins: units.gu(1)
@@ -44,121 +45,168 @@ UbuntuShape {
47− Wallpaper {
48+ Rectangle {
48 anchors.fill: parent
49 anchors.fill: parent
49 anchors.topMargin: header.height
50 anchors.topMargin: header.height
50− source: previewSpace.background
51+ color: "blue"
53 Repeater {
53 Repeater {
54− id: topLevelSurfaceRepeater
54+ id: workspaceRepeater
58+ x: index * previewSpace.screenWidth * previewScale
59+ height: previewSpace.screenHeight * previewScale
60+ width: previewSpace.screenWidth * previewScale
64+ source: previewSpace.background
68+ // id: topLevelSurfaceRepeater
55− model: visible ? topLevelSurfaceList : null
69+ // model: visible ? topLevelSurfaceList : null
56− delegate: Rectangle {
70+ // delegate: Rectangle {
57− width: surfaceItem.width
71+ // width: surfaceItem.width
58− height: surfaceItem.height + decorationHeight * previewScale
72+ // height: surfaceItem.height + decorationHeight * previewScale
59− x: model.window.position.x * previewScale
73+ // x: model.window.position.x * previewScale
60− y: (model.window.position.y - decorationHeight) * previewScale
74+ // y: (model.window.position.y - decorationHeight) * previewScale
61− color: "blue"
75+ // color: "blue"
62− z: topLevelSurfaceRepeater.count - index
76+ // z: topLevelSurfaceRepeater.count - index
64− property int decorationHeight: units.gu(3)
78+ // property int decorationHeight: units.gu(3)
66− WindowDecoration {
80+ // WindowDecoration {
67− width: surfaceItem.implicitWidth
81+ // width: surfaceItem.implicitWidth
68− height: parent.decorationHeight
82+ // height: parent.decorationHeight
69− transform: Scale {
83+ // transform: Scale {
70− origin.x: 0
84+ // origin.x: 0
71− origin.y: 0
85+ // origin.y: 0
72− xScale: previewScale
86+ // xScale: previewScale
73− yScale: previewScale
87+ // yScale: previewScale
75− title: model.window && model.window.surface ? model.window.surface.name : ""
89+ // title: model.window && model.window.surface ? model.window.surface.name : ""
79− MirSurfaceItem {
93+ // MirSurfaceItem {
80− id: surfaceItem
94+ // id: surfaceItem
81− y: parent.decorationHeight * previewScale
95+ // y: parent.decorationHeight * previewScale
82− width: implicitWidth * previewScale
96+ // width: implicitWidth * previewScale
83− height: implicitHeight * previewScale
97+ // height: implicitHeight * previewScale
84− surfaceWidth: -1
98+ // surfaceWidth: -1
85− surfaceHeight: -1
99+ // surfaceHeight: -1
86− onImplicitHeightChanged: print("item", surfaceItem, "height changed", implicitHeight)
100+ // onImplicitHeightChanged: print("item", surfaceItem, "height changed", implicitHeight)
87− surface: model.window.surface
101+ // surface: model.window.surface
95− anchors.centerIn: parent
96− anchors.verticalCenterOffset: header.height / 2
100− opacity: containsMouse ? 1 : 0
111+// anchors.centerIn: parent
112+// anchors.verticalCenterOffset: header.height / 2
113+// width: units.gu(8)
115+// hoverEnabled: true
116+// opacity: containsMouse ? 1 : 0
102− Rectangle {
118+// Rectangle {
103− anchors.fill: parent
119+// anchors.fill: parent
104− color: "#80000000"
120+// color: "#80000000"
105− radius: height / 2
121+// radius: height / 2
126+// property: "progress"
128+// running: mouseArea.containsMouse
135+// height: parent.height
137+// anchors.centerIn: parent
139+// property real progress: 0.5
140+// property int lineWidth: units.dp(4)
141+// onProgressChanged: {
143+// if (progress == 1) {
144+// Screens.activateScreen(index);
151+// var ctx = canvas.getContext("2d");
155+// ctx.lineWidth = lineWidth;
157+// ctx.strokeStyle = "#3bffffff"
159+// ctx.arc(canvas.width/2,canvas.height/2, (canvas.height - ctx.lineWidth) / 2, 0, (Math.PI*2),false);
163+// ctx.strokeStyle = "white"
165+// ctx.arc(canvas.width/2,canvas.height/2, (canvas.height - ctx.lineWidth) / 2, 0, (Math.PI*2*(progress)),false);
174+// source: "graphics/multi-monitor_leave.png"
175+// height: units.gu(4)
177+// anchors.centerIn: parent
108− NumberAnimation {
182+ FloatingFlickable {
109− target: canvas
183+ id: flickable
184+ anchors.fill: parent
185+ contentWidth: workspaceRepeater.count * previewSpace.screenWidth * previewScale
110− property: "progress"
186+ property real progress: contentX / contentWidth
111− duration: 2000
187+ onContentXChanged: print("contentX:", contentX, "progress:", progress)
112− running: mouseArea.containsMouse
117− Canvas {
190+ MouseArea {
119− height: parent.height
121− anchors.centerIn: parent
191+ anchors.fill: parent
122−
192+ hoverEnabled: true
123− property real progress: 0.5
193+ property int scrollAreaWidth: width / 3
124− property int lineWidth: units.dp(4)
125− onProgressChanged: {
127− if (progress == 1) {
128− Screens.activateScreen(index);
135− var ctx = canvas.getContext("2d");
139− ctx.lineWidth = lineWidth;
141− ctx.strokeStyle = "#3bffffff"
143− ctx.arc(canvas.width/2,canvas.height/2, (canvas.height - ctx.lineWidth) / 2, 0, (Math.PI*2),false);
147− ctx.strokeStyle = "white"
195+ onMouseXChanged: {
148− ctx.beginPath();
196+ var margins = flickable.width * 0.05;
149− ctx.arc(canvas.width/2,canvas.height/2, (canvas.height - ctx.lineWidth) / 2, 0, (Math.PI*2*(progress)),false);
153− ctx.restore();
198+ // do we need to scroll?
199+ if (mouseX < scrollAreaWidth + margins) {
200+ var progress = Math.min(1, (scrollAreaWidth + margins - mouseX) / (scrollAreaWidth - margins));
201+ var contentX = (1 - progress) * (flickable.contentWidth - flickable.width)
202+ flickable.contentX = Math.max(0, Math.min(flickable.contentX, contentX))
204+ if (mouseX > flickable.width - scrollAreaWidth) {
205+ var progress = Math.min(1, (mouseX - (flickable.width - scrollAreaWidth)) / (scrollAreaWidth - margins))
206+ var contentX = progress * (flickable.contentWidth - flickable.width)
207+ flickable.contentX = Math.min(flickable.contentWidth - flickable.width, Math.max(flickable.contentX, contentX))
158− source: "graphics/multi-monitor_leave.png"
161− anchors.centerIn: parent