on xenial help sign in
add workspaces snapshotting through a shader effect
35fe404Michael Zanetti
qml/Stages/DesktopStage.qml+39−8
@@ -124,6 +124,8 @@ FocusScope {
124 }
124 }
125
125
126 Item {
126 Item {
127+ id: appContainer
128+ anchors.fill: parent
127 Repeater {
129 Repeater {
128 id: appRepeater
130 id: appRepeater
129 model: ApplicationManager
131 model: ApplicationManager
@@ -157,7 +159,7 @@ FocusScope {
157 PropertyChanges { target: appDelegate; x: -appDelegate.width / 2; scale: units.gu(5) / appDelegate.width; opacity: 0 }
159 PropertyChanges { target: appDelegate; x: -appDelegate.width / 2; scale: units.gu(5) / appDelegate.width; opacity: 0 }
158 },
160 },
159 State {
161 State {
160− name: "altTab"; when: root.state == "altTab"
162+ name: "altTab"; when: root.state == "altTab" && root.workspacesUpdated
161 PropertyChanges {
163 PropertyChanges {
162 target: appDelegate
164 target: appDelegate
163 x: spreadMaths.animatedX
165 x: spreadMaths.animatedX
@@ -351,7 +353,8 @@ FocusScope {
351 }
353 }
352 height: root.height * 0.25
354 height: root.height * 0.25
353 color: "#55000000"
355 color: "#55000000"
354− opacity: 0
356+// opacity: 0
357+ visible: false
355
358
356 RowLayout {
359 RowLayout {
357 anchors.fill: parent
360 anchors.fill: parent
@@ -362,14 +365,33 @@ FocusScope {
362 Item {
365 Item {
363 Layout.fillHeight: true
366 Layout.fillHeight: true
364 Layout.preferredWidth: ((height - units.gu(6)) * root.width / root.height)
367 Layout.preferredWidth: ((height - units.gu(6)) * root.width / root.height)
365−
366 Image {
368 Image {
369+ source: root.background
367 anchors {
370 anchors {
368 fill: parent;
371 fill: parent;
369 topMargin: units.gu(2);
372 topMargin: units.gu(2);
370 bottomMargin: units.gu(2);
373 bottomMargin: units.gu(2);
371 }
374 }
372− source: root.background
375+
376+ ShaderEffect {
377+ anchors.fill: parent
378+
379+ property var source: ShaderEffectSource {
380+ id: shaderEffectSource
381+ live: false
382+ sourceItem: appContainer
383+ Connections { target: root; onUpdateWorkspaces: shaderEffectSource.scheduleUpdate() }
384+ }
385+
386+ fragmentShader: "
387+ varying highp vec2 qt_TexCoord0;
388+ uniform sampler2D source;
389+ void main(void)
390+ {
391+ highp vec4 sourceColor = texture2D(source, qt_TexCoord0);
392+ gl_FragColor = sourceColor;
393+ }"
394+ }
373 }
395 }
374
396
375 Rectangle {
397 Rectangle {
@@ -421,24 +443,33 @@ FocusScope {
421 },
443 },
422 State {
444 State {
423 name: "altTab"; when: root.altTabPressed
445 name: "altTab"; when: root.altTabPressed
446+ PropertyChanges { target: workspaceSelector; visible: true }
424 PropertyChanges { target: spreadFlickable; visible: true }
447 PropertyChanges { target: spreadFlickable; visible: true }
425− PropertyChanges { target: workspaceSelector; opacity: 1 }
426 }
448 }
427 ]
449 ]
450+ signal updateWorkspaces();
451+ property bool workspacesUpdated: false
428 transitions: [
452 transitions: [
429 Transition {
453 Transition {
430 from: "*"
454 from: "*"
431 to: "altTab"
455 to: "altTab"
456+ SequentialAnimation {
457+ PropertyAction { target: workspaceSelector; property: "visible" }
458+ ScriptAction { script: root.updateWorkspaces() }
459+ PauseAnimation { duration: 50 }
460+ PropertyAction { target: root; property: "workspacesUpdated"; value: true }
461+ PropertyAction { target: spreadFlickable; property: "visible" }
432− PropertyAction { target: spreadFlickable; property: "contentX";
462+ PropertyAction { target: spreadFlickable; property: "contentX";
433− value: ((spreadFlickable.contentWidth) / (ApplicationManager.count + 1)) * Math.max(0, Math.min(ApplicationManager.count - 3, 1));
463+ value: ((spreadFlickable.contentWidth) / (ApplicationManager.count + 1)) * Math.max(0, Math.min(ApplicationManager.count - 3, 1));
434
464
465+ }
435 }
466 }
436− PropertyAnimation { property: "opacity" }
437 },
467 },
438 Transition {
468 Transition {
439 from: "*"
469 from: "*"
440 to: "*"
470 to: "*"
441 PropertyAnimation { property: "opacity" }
471 PropertyAnimation { property: "opacity" }
472+ PropertyAction { target: root; property: "workspacesUpdated"; value: false }
442 }
473 }
443
474
444 ]
475 ]