Merge lp:~unity-2d-team/unity-2d/real-transparency into lp:unity-2d/3.0

Proposed by Ugo Riboni
Status: Merged
Merged at revision: 586
Proposed branch: lp:~unity-2d-team/unity-2d/real-transparency
Merge into: lp:unity-2d/3.0
Diff against target: 647 lines (+174/-240)
17 files modified
debian/libunity-2d-private0.install (+1/-0)
launcher/Launcher.qml (+18/-2)
launcher/app/launcher.cpp (+1/-4)
launcher/app/launcherview.cpp (+8/-0)
libunity-2d-private/Unity2d/CMakeLists.txt (+3/-1)
libunity-2d-private/Unity2d/GnomeBackground.qml (+113/-0)
libunity-2d-private/Unity2d/qmldir (+2/-0)
libunity-2d-private/Unity2d/screeninfo.cpp (+5/-0)
libunity-2d-private/Unity2d/screeninfo.h (+4/-0)
libunity-2d-private/src/unity2dpanel.cpp (+8/-2)
libunity-2d-private/src/unity2dpanel.h (+1/-1)
places/GnomeBackground.qml (+0/-107)
places/app/dashdeclarativeview.cpp (+0/-6)
places/app/dashdeclarativeview.h (+0/-3)
places/dash.qml (+6/-5)
spread/GnomeBackground.qml (+0/-109)
spread/Workspace.qml (+4/-0)
To merge this branch: bzr merge lp:~unity-2d-team/unity-2d/real-transparency
Reviewer Review Type Date Requested Status
Florian Boucault (community) Approve
Review via email: mp+62096@code.launchpad.net

Commit message

[dash][launcher] Implement real transparency when there's a compositor running.

Description of the change

This branch implements real transparency in the launcher and dash when a compositing manager is active.

The opacity of the transparency may be off and need to be double checked.

Please also note that I put in some fixes in the GnomeBackground QML class, which now is not tied anymore to a specific view (it is still copied in two places, but it's easier to merge into a plugin when we decide to do that).

There's also a fix for performance, so that the fake background is only loaded when the compositor is not running.

Finally, please note that the bug regarding slideshow backgrounds (703574) is fixed by this patch only when compositing mode is running. The fake transparency code still has the issue.
I suppose it can be fixed in the fake transparency case by taking the screenshot of the Nautilus desktop window, but then it would need to look for damage events on that window and update, and I didn't have time to implement that solution yet.

To post a comment you must log in.
Revision history for this message
Florian Boucault (fboucault) wrote :

The panel exhibits visual artifacts. See http://people.canonical.com/~kaleo/transparency_bugs.png

review: Needs Fixing
Revision history for this message
Florian Boucault (fboucault) wrote :

The background of the launcher used to have a one pixel line on its right. It is important to the visual design.

review: Needs Fixing
Revision history for this message
Florian Boucault (fboucault) wrote :

The spread used to have a few pixels of separation between each workspace.

review: Needs Fixing
Revision history for this message
Florian Boucault (fboucault) wrote :

The spread performance is highly hampered with that patch. Going in and out of the spread is sluggish (quite more than before).

review: Needs Fixing
Revision history for this message
Ugo Riboni (uriboni) wrote :

The revisions I just pushed should have put back the space between the workspaces in the spread, and fixed the performance regression.

I also put back the border in the launcher. I'm not sure if the way I did it was the most efficient. I also thought of using a 1px wide Rectangle, but went for the tiled pixel for now. Should be easy to change if you think it's better the other way around.

Finally I could not reproduce the corruption in the panel. I am unsure what may cause it since as you can see I don't touch anything in the panel.

Revision history for this message
Florian Boucault (fboucault) wrote :

Everything is good to go now :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/libunity-2d-private0.install'
2--- debian/libunity-2d-private0.install 2011-02-02 16:57:00 +0000
3+++ debian/libunity-2d-private0.install 2011-06-06 17:26:28 +0000
4@@ -1,3 +1,4 @@
5 usr/lib/libunity-2d-private.so.*
6 usr/lib/qt4/imports/Unity2d/libunity-2d-private-qml.so
7 usr/lib/qt4/imports/Unity2d/qmldir
8+usr/lib/qt4/imports/Unity2d/*.qml
9
10=== modified file 'launcher/Launcher.qml'
11--- launcher/Launcher.qml 2011-05-11 10:29:54 +0000
12+++ launcher/Launcher.qml 2011-06-06 17:26:28 +0000
13@@ -23,10 +23,26 @@
14 DropItem {
15 id: launcher
16
17+ GnomeBackground {
18+ anchors.fill: parent
19+ overlay_color: "black"
20+ overlay_alpha: 0.66
21+ visible: !screen.isCompositingManagerRunning
22+ }
23+
24+ Rectangle {
25+ anchors.fill: parent
26+ color: "black"
27+ opacity: 0.66
28+ visible: screen.isCompositingManagerRunning
29+ }
30+
31 Image {
32- id: background
33+ id: border
34
35- anchors.fill: parent
36+ width: 1
37+ height: parent.height
38+ anchors.right: parent.right
39 fillMode: Image.TileVertically
40 source: "artwork/background.png"
41 }
42
43=== modified file 'launcher/app/launcher.cpp'
44--- launcher/app/launcher.cpp 2011-06-06 09:23:48 +0000
45+++ launcher/app/launcher.cpp 2011-06-06 17:26:28 +0000
46@@ -106,7 +106,7 @@
47 Unity2dTr::init("unity-2d", INSTALL_PREFIX "/share/locale");
48
49 /* Panel containing the QML declarative view */
50- Unity2dPanel panel;
51+ Unity2dPanel panel(true);
52 panel.setEdge(Unity2dPanel::LeftEdge);
53 panel.setFixedWidth(LauncherClient::MaximumWidth);
54
55@@ -116,9 +116,6 @@
56 LauncherView *launcherView = new LauncherView(&panel);
57 launcherView->setUseOpenGL(arguments.contains("-opengl"));
58
59- /* FIXME: possible optimisations */
60-// launcherView->setAttribute(Qt::WA_OpaquePaintEvent);
61-// launcherView->setAttribute(Qt::WA_NoSystemBackground);
62 launcherView->setResizeMode(QDeclarativeView::SizeRootObjectToView);
63 launcherView->setFocus();
64
65
66=== modified file 'launcher/app/launcherview.cpp'
67--- launcher/app/launcherview.cpp 2011-05-30 18:46:16 +0000
68+++ launcher/app/launcherview.cpp 2011-06-06 17:26:28 +0000
69@@ -61,6 +61,14 @@
70 Unity2DDeclarativeView(parent),
71 m_superKeyPressed(false), m_superKeyHeld(false)
72 {
73+ if (QX11Info::isCompositingManagerRunning()) {
74+ setAttribute(Qt::WA_TranslucentBackground);
75+ viewport()->setAttribute(Qt::WA_TranslucentBackground);
76+ } else {
77+ setAttribute(Qt::WA_OpaquePaintEvent);
78+ setAttribute(Qt::WA_NoSystemBackground);
79+ }
80+
81 m_superKeyHoldTimer.setSingleShot(true);
82 m_superKeyHoldTimer.setInterval(KEY_HOLD_THRESHOLD);
83 connect(&m_superKeyHoldTimer, SIGNAL(timeout()), SLOT(updateSuperKeyHoldState()));
84
85=== modified file 'launcher/artwork/background.png'
86Binary files launcher/artwork/background.png 2011-02-09 19:32:23 +0000 and launcher/artwork/background.png 2011-06-06 17:26:28 +0000 differ
87=== modified file 'libunity-2d-private/Unity2d/CMakeLists.txt'
88--- libunity-2d-private/Unity2d/CMakeLists.txt 2011-05-18 15:47:16 +0000
89+++ libunity-2d-private/Unity2d/CMakeLists.txt 2011-06-06 17:26:28 +0000
90@@ -34,6 +34,8 @@
91 dropitem.h
92 )
93
94+file(GLOB unity-2d-private-qml_QML *.qml)
95+
96 qt4_wrap_cpp(unity-2d-private-qml_MOC_SRCS ${unity-2d-private-qml_MOC_HDRS})
97
98 # Build
99@@ -65,7 +67,7 @@
100 LIBRARY DESTINATION ${IMPORT_INSTALL_DIR}
101 )
102
103-install(FILES qmldir
104+install(FILES qmldir ${unity-2d-private-qml_QML}
105 DESTINATION ${IMPORT_INSTALL_DIR}
106 )
107
108
109=== added file 'libunity-2d-private/Unity2d/GnomeBackground.qml'
110--- libunity-2d-private/Unity2d/GnomeBackground.qml 1970-01-01 00:00:00 +0000
111+++ libunity-2d-private/Unity2d/GnomeBackground.qml 2011-06-06 17:26:28 +0000
112@@ -0,0 +1,113 @@
113+/*
114+ * This file is part of unity-2d
115+ *
116+ * Copyright 2010-2011 Canonical Ltd.
117+ *
118+ * This program is free software; you can redistribute it and/or modify
119+ * it under the terms of the GNU General Public License as published by
120+ * the Free Software Foundation; version 3.
121+ *
122+ * This program is distributed in the hope that it will be useful,
123+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
124+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
125+ * GNU General Public License for more details.
126+ *
127+ * You should have received a copy of the GNU General Public License
128+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
129+ */
130+
131+import Qt 4.7
132+import gconf 1.0
133+/* Necessary to access the blended image provider and CacheEffect */
134+import Unity2d 1.0
135+
136+Item {
137+ property string overlay_color
138+ property real overlay_alpha
139+
140+ /* Avoid redraw at rendering */
141+ CacheEffect {
142+ id: cacheEffect
143+ }
144+ property bool cached: true
145+ effect: (cached) ? cacheEffect : null
146+
147+ GConfItem {
148+ id: primary_color
149+ key: "/desktop/gnome/background/primary_color"
150+ }
151+
152+ GConfItem {
153+ id: picture_filename
154+ key: "/desktop/gnome/background/picture_filename"
155+ }
156+
157+ GConfItem {
158+ id: picture_options
159+ key: "/desktop/gnome/background/picture_options"
160+ }
161+
162+ Rectangle {
163+ Rectangle {
164+ anchors.fill: parent
165+ opacity: overlay_alpha
166+ color: overlay_color
167+ }
168+
169+ anchors.fill: parent
170+ color: primary_color.value
171+ }
172+
173+ Image {
174+ id: picture
175+
176+ visible: picture_filename.value
177+ source: {
178+ if (!visible) return ""
179+
180+ /* FIXME: Because /usr/share/backgrounds/warty-final-ubuntu.png is
181+ actually a jpeg and Qt relies by default on the extension
182+ that particular background fails to load. We workaround
183+ it by having our own symlink with a 'jpg' extension.
184+
185+ References:
186+ https://bugs.launchpad.net/ubuntu/+source/ubuntu-wallpapers/+bug/296538
187+ http://bugreports.qt.nokia.com/browse/QTBUG-7276
188+ */
189+ var filename = picture_filename.value
190+ if(filename == "/usr/share/backgrounds/warty-final-ubuntu.png")
191+ filename = engineBaseUrl + "artwork/warty-final-ubuntu.jpg"
192+
193+ if(overlay_alpha > 0.0)
194+ return "image://blended/%1color=%2alpha=%3".arg(filename).arg(overlay_color).arg(overlay_alpha)
195+ else
196+ return filename
197+ }
198+ width: screen.geometry.width
199+ height: screen.geometry.height
200+
201+ smooth: true
202+ x: screen.availableGeometry.x
203+ y: -screen.availableGeometry.y
204+
205+ /* Possible modes are:
206+ - "wallpaper"
207+ - "centered" (NOT IMPLEMENTED)
208+ - "scaled"
209+ - "stretched"
210+ - "zoom"
211+ - "spanned" (NOT IMPLEMENTED)
212+ */
213+ fillMode: {
214+ if(picture_options.value == "wallpaper")
215+ return Image.Tile
216+ else if(picture_options.value == "scaled")
217+ return Image.PreserveAspectFit
218+ else if(picture_options.value == "stretched")
219+ return Image.Stretch
220+ else if(picture_options.value == "zoom")
221+ return Image.PreserveAspectCrop
222+ else return Image.PreserveAspectFit
223+ }
224+ }
225+}
226
227=== modified file 'libunity-2d-private/Unity2d/qmldir'
228--- libunity-2d-private/Unity2d/qmldir 2011-02-02 16:57:00 +0000
229+++ libunity-2d-private/Unity2d/qmldir 2011-06-06 17:26:28 +0000
230@@ -1,1 +1,3 @@
231 plugin unity-2d-private-qml
232+
233+GnomeBackground 1.0 GnomeBackground.qml
234
235=== modified file 'libunity-2d-private/Unity2d/screeninfo.cpp'
236--- libunity-2d-private/Unity2d/screeninfo.cpp 2011-02-08 12:34:50 +0000
237+++ libunity-2d-private/Unity2d/screeninfo.cpp 2011-06-06 17:26:28 +0000
238@@ -93,3 +93,8 @@
239 Q_EMIT availableGeometryChanged(availableGeometry());
240 }
241 }
242+
243+bool ScreenInfo::isCompositingManagerRunning() const
244+{
245+ return QX11Info::isCompositingManagerRunning();
246+}
247
248=== modified file 'libunity-2d-private/Unity2d/screeninfo.h'
249--- libunity-2d-private/Unity2d/screeninfo.h 2011-02-08 12:34:50 +0000
250+++ libunity-2d-private/Unity2d/screeninfo.h 2011-06-06 17:26:28 +0000
251@@ -21,6 +21,8 @@
252 Q_PROPERTY(unsigned int activeWindow READ activeWindow NOTIFY activeWindowChanged)
253 Q_PROPERTY(QRect geometry READ geometry NOTIFY geometryChanged)
254 Q_PROPERTY(QRect availableGeometry READ availableGeometry NOTIFY availableGeometryChanged)
255+ Q_PROPERTY(bool isCompositingManagerRunning READ isCompositingManagerRunning
256+ NOTIFY isCompositingManagerRunningChanged)
257
258 public:
259 static ScreenInfo* instance();
260@@ -35,12 +37,14 @@
261 unsigned int activeWindow() const { return m_activeWindow; }
262 QRect availableGeometry() const;
263 QRect geometry() const;
264+ bool isCompositingManagerRunning() const;
265
266 Q_SIGNALS:
267 void activeWindowChanged(unsigned int activeWindow);
268 void geometryChanged(QRect geometry);
269 void availableGeometryChanged(QRect availableGeometry);
270 void workspacesChanged(WorkspacesInfo *workspaces);
271+ void isCompositingManagerRunningChanged(bool);
272
273 private:
274 explicit ScreenInfo(QObject *parent = 0);
275
276=== modified file 'libunity-2d-private/src/unity2dpanel.cpp'
277--- libunity-2d-private/src/unity2dpanel.cpp 2011-05-25 10:18:52 +0000
278+++ libunity-2d-private/src/unity2dpanel.cpp 2011-06-06 17:26:28 +0000
279@@ -131,7 +131,7 @@
280 }
281 };
282
283-Unity2dPanel::Unity2dPanel(QWidget* parent)
284+Unity2dPanel::Unity2dPanel(bool requiresTransparency, QWidget* parent)
285 : QWidget(parent)
286 , d(new Unity2dPanelPrivate)
287 {
288@@ -158,7 +158,13 @@
289
290 setAttribute(Qt::WA_X11NetWmWindowTypeDock);
291 setAttribute(Qt::WA_Hover);
292- setAutoFillBackground(true);
293+
294+ if (QX11Info::isCompositingManagerRunning() && requiresTransparency) {
295+ setAttribute(Qt::WA_TranslucentBackground);
296+ } else {
297+ setAutoFillBackground(true);
298+ }
299+
300 connect(QApplication::desktop(), SIGNAL(workAreaResized(int)), SLOT(slotWorkAreaResized(int)));
301 }
302
303
304=== modified file 'libunity-2d-private/src/unity2dpanel.h'
305--- libunity-2d-private/src/unity2dpanel.h 2011-02-20 23:58:30 +0000
306+++ libunity-2d-private/src/unity2dpanel.h 2011-06-06 17:26:28 +0000
307@@ -50,7 +50,7 @@
308 TopEdge
309 };
310
311- Unity2dPanel(QWidget* parent = 0);
312+ Unity2dPanel(bool requiresTransparency = false, QWidget* parent = 0);
313 ~Unity2dPanel();
314
315 void setEdge(Edge);
316
317=== removed file 'places/GnomeBackground.qml'
318--- places/GnomeBackground.qml 2011-03-22 06:15:19 +0000
319+++ places/GnomeBackground.qml 1970-01-01 00:00:00 +0000
320@@ -1,107 +0,0 @@
321-/*
322- * This file is part of unity-2d
323- *
324- * Copyright 2010-2011 Canonical Ltd.
325- *
326- * This program is free software; you can redistribute it and/or modify
327- * it under the terms of the GNU General Public License as published by
328- * the Free Software Foundation; version 3.
329- *
330- * This program is distributed in the hope that it will be useful,
331- * but WITHOUT ANY WARRANTY; without even the implied warranty of
332- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
333- * GNU General Public License for more details.
334- *
335- * You should have received a copy of the GNU General Public License
336- * along with this program. If not, see <http://www.gnu.org/licenses/>.
337- */
338-
339-import Qt 4.7
340-import gconf 1.0
341-/* Necessary to access the blended image provider and CacheEffect */
342-import Unity2d 1.0
343-
344-Item {
345- property string overlay_color
346- property real overlay_alpha
347-
348- /* Avoid redraw at rendering */
349- effect: CacheEffect {}
350-
351- GConfItem {
352- id: primary_color
353- key: "/desktop/gnome/background/primary_color"
354- }
355-
356- GConfItem {
357- id: picture_filename
358- key: "/desktop/gnome/background/picture_filename"
359- }
360-
361- GConfItem {
362- id: picture_options
363- key: "/desktop/gnome/background/picture_options"
364- }
365-
366- Rectangle {
367- Rectangle {
368- anchors.fill: parent
369- opacity: overlay_alpha
370- color: overlay_color
371- }
372-
373- anchors.fill: parent
374- color: primary_color.value
375- }
376-
377- Image {
378- id: picture
379-
380- visible: picture_filename.value
381- source: {
382- /* FIXME: Because /usr/share/backgrounds/warty-final-ubuntu.png is
383- actually a jpeg and Qt relies by default on the extension
384- that particular background fails to load. We workaround
385- it by having our own symlink with a 'jpg' extension.
386-
387- References:
388- https://bugs.launchpad.net/ubuntu/+source/ubuntu-wallpapers/+bug/296538
389- http://bugreports.qt.nokia.com/browse/QTBUG-7276
390- */
391- var filename = picture_filename.value
392- if(filename == "/usr/share/backgrounds/warty-final-ubuntu.png")
393- filename = engineBaseUrl + "artwork/warty-final-ubuntu.jpg"
394-
395- if(overlay_alpha > 0.0)
396- return "image://blended/%1color=%2alpha=%3".arg(filename).arg(overlay_color).arg(overlay_alpha)
397- else
398- return filename
399- }
400- width: dashView.screenGeometry.width
401- height: dashView.screenGeometry.height
402-
403- smooth: true
404- x: -dashView.availableGeometry.x
405- y: -dashView.availableGeometry.y
406-
407- /* Possible modes are:
408- - "wallpaper"
409- - "centered" (NOT IMPLEMENTED)
410- - "scaled"
411- - "stretched"
412- - "zoom"
413- - "spanned" (NOT IMPLEMENTED)
414- */
415- fillMode: {
416- if(picture_options.value == "wallpaper")
417- return Image.Tile
418- else if(picture_options.value == "scaled")
419- return Image.PreserveAspectFit
420- else if(picture_options.value == "stretched")
421- return Image.Stretch
422- else if(picture_options.value == "zoom")
423- return Image.PreserveAspectCrop
424- else return Image.PreserveAspectFit
425- }
426- }
427-}
428
429=== modified file 'places/app/dashdeclarativeview.cpp'
430--- places/app/dashdeclarativeview.cpp 2011-04-29 16:26:25 +0000
431+++ places/app/dashdeclarativeview.cpp 2011-06-06 17:26:28 +0000
432@@ -369,12 +369,6 @@
433 }
434
435 bool
436-DashDeclarativeView::isCompositingManagerRunning() const
437-{
438- return QX11Info::isCompositingManagerRunning();
439-}
440-
441-bool
442 DashDeclarativeView::connectToBus()
443 {
444 bool ok = QDBusConnection::sessionBus().registerService(DASH_DBUS_SERVICE);
445
446=== modified file 'places/app/dashdeclarativeview.h'
447--- places/app/dashdeclarativeview.h 2011-04-29 16:26:25 +0000
448+++ places/app/dashdeclarativeview.h 2011-06-06 17:26:28 +0000
449@@ -33,7 +33,6 @@
450 Q_PROPERTY(QString activePlaceEntry READ activePlaceEntry WRITE setActivePlaceEntry NOTIFY activePlaceEntryChanged)
451 Q_PROPERTY(QRect screenGeometry READ screenGeometry NOTIFY screenGeometryChanged)
452 Q_PROPERTY(QRect availableGeometry READ availableGeometry NOTIFY availableGeometryChanged)
453- Q_PROPERTY(bool isCompositingManagerRunning READ isCompositingManagerRunning NOTIFY isCompositingManagerRunningChanged)
454
455 public:
456 enum DashMode {
457@@ -50,7 +49,6 @@
458 const QRect screenGeometry() const;
459 QRect availableGeometry() const;
460 bool expanded() const;
461- bool isCompositingManagerRunning() const;
462
463 /* setters */
464 Q_SLOT void setActive(bool active);
465@@ -71,7 +69,6 @@
466
467 void screenGeometryChanged();
468 void availableGeometryChanged();
469- void isCompositingManagerRunningChanged(bool);
470
471 protected:
472 void resizeEvent(QResizeEvent*);
473
474=== modified file 'places/dash.qml'
475--- places/dash.qml 2011-05-11 12:57:59 +0000
476+++ places/dash.qml 2011-06-06 17:26:28 +0000
477@@ -19,6 +19,7 @@
478 import Qt 4.7
479 import UnityApplications 1.0 /* Necessary for LauncherPlacesList */
480 import Places 1.0 /* Necessary for DashDeclarativeView.*Dash */
481+import Unity2d 1.0 /* Necessary for GnomeBackground */
482
483 Item {
484 id: dash
485@@ -86,21 +87,21 @@
486 GnomeBackground {
487 anchors.fill: parent
488 overlay_color: "black"
489- overlay_alpha: 0.71
490- visible: dashView.dashMode == DashDeclarativeView.FullScreenMode && !dashView.isCompositingManagerRunning
491+ overlay_alpha: 0.89
492+ visible: dashView.dashMode == DashDeclarativeView.FullScreenMode && !screen.isCompositingManagerRunning
493 }
494
495 Rectangle {
496 anchors.fill: parent
497 color: "black"
498- opacity: 0.69
499- visible: dashView.dashMode == DashDeclarativeView.FullScreenMode && dashView.isCompositingManagerRunning
500+ opacity: 0.89
501+ visible: dashView.dashMode == DashDeclarativeView.FullScreenMode && screen.isCompositingManagerRunning
502 }
503
504 BorderImage {
505 anchors.fill: parent
506 visible: dashView.dashMode == DashDeclarativeView.DesktopMode
507- source: dashView.isCompositingManagerRunning ? "artwork/desktop_dash_background.sci" : "artwork/desktop_dash_background_no_transparency.sci"
508+ source: screen.isCompositingManagerRunning ? "artwork/desktop_dash_background.sci" : "artwork/desktop_dash_background_no_transparency.sci"
509 }
510 /* /Backgrounds */
511
512
513=== removed file 'spread/GnomeBackground.qml'
514--- spread/GnomeBackground.qml 2011-04-19 14:11:36 +0000
515+++ spread/GnomeBackground.qml 1970-01-01 00:00:00 +0000
516@@ -1,109 +0,0 @@
517-/*
518- * This file is part of unity-2d
519- *
520- * Copyright 2010-2011 Canonical Ltd.
521- *
522- * This program is free software; you can redistribute it and/or modify
523- * it under the terms of the GNU General Public License as published by
524- * the Free Software Foundation; version 3.
525- *
526- * This program is distributed in the hope that it will be useful,
527- * but WITHOUT ANY WARRANTY; without even the implied warranty of
528- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
529- * GNU General Public License for more details.
530- *
531- * You should have received a copy of the GNU General Public License
532- * along with this program. If not, see <http://www.gnu.org/licenses/>.
533- */
534-
535-import Qt 4.7
536-import gconf 1.0
537-/* Necessary to access the blended image provider and CacheEffect */
538-import Unity2d 1.0
539-
540-Item {
541- property string overlay_color
542- property real overlay_alpha
543- clip: true
544-
545-// FIXME: disabled since it doesn't work properly with a size animation
546-// /* Avoid redraw at rendering */
547-// effect: CacheEffect {}
548-
549- GConfItem {
550- id: primary_color
551- key: "/desktop/gnome/background/primary_color"
552- }
553-
554- GConfItem {
555- id: picture_filename
556- key: "/desktop/gnome/background/picture_filename"
557- }
558-
559- GConfItem {
560- id: picture_options
561- key: "/desktop/gnome/background/picture_options"
562- }
563-
564- Rectangle {
565- Rectangle {
566- anchors.fill: parent
567- opacity: overlay_alpha
568- color: overlay_color
569- }
570-
571- anchors.fill: parent
572- color: primary_color.value
573- }
574-
575- Image {
576- id: picture
577-
578- visible: picture_filename.value
579- source: {
580- /* FIXME: Because /usr/share/backgrounds/warty-final-ubuntu.png is
581- actually a jpeg and Qt relies by default on the extension
582- that particular background fails to load. We workaround
583- it by having our own symlink with a 'jpg' extension.
584-
585- References:
586- https://bugs.launchpad.net/ubuntu/+source/ubuntu-wallpapers/+bug/296538
587- http://bugreports.qt.nokia.com/browse/QTBUG-7276
588- */
589- var filename = picture_filename.value
590- if(filename == "/usr/share/backgrounds/warty-final-ubuntu.png")
591- filename = engineBaseUrl + "artwork/warty-final-ubuntu.jpg"
592-
593- if(overlay_alpha > 0.0)
594- return "image://blended/%1color=%2alpha=%3".arg(filename).arg(overlay_color).arg(overlay_alpha)
595- else
596- return filename
597- }
598- width: screen.geometry.width
599- height: screen.geometry.height
600-
601- smooth: true
602- x: - launcherMaximumWidth
603- y: - screen.availableGeometry.y
604-
605- /* Possible modes are:
606- - "wallpaper"
607- - "centered" (NOT IMPLEMENTED)
608- - "scaled"
609- - "stretched"
610- - "zoom"
611- - "spanned" (NOT IMPLEMENTED)
612- */
613- fillMode: {
614- if(picture_options.value == "wallpaper")
615- return Image.Tile
616- else if(picture_options.value == "scaled")
617- return Image.PreserveAspectFit
618- else if(picture_options.value == "stretched")
619- return Image.Stretch
620- else if(picture_options.value == "zoom")
621- return Image.PreserveAspectCrop
622- else return Image.PreserveAspectFit
623- }
624- }
625-}
626
627=== modified file 'spread/Workspace.qml'
628--- spread/Workspace.qml 2011-03-22 06:04:20 +0000
629+++ spread/Workspace.qml 2011-06-06 17:26:28 +0000
630@@ -18,6 +18,7 @@
631
632 import Qt 4.7
633 import "utils.js" as Utils
634+import Unity2d 1.0 /* Necessary for GnomeBackground */
635
636 FocusScope {
637 id: workspace
638@@ -37,6 +38,9 @@
639 anchors.fill: parent
640 overlay_color: "black"
641 overlay_alpha: 0
642+
643+ clip: true
644+ cached: false
645 }
646
647 Windows {

Subscribers

People subscribed via source and target branches

to all changes: