Merge lp:~gerboland/unity-2d/shell-background-isolate into lp:unity-2d

Proposed by Gerry Boland
Status: Merged
Approved by: Albert Astals Cid
Approved revision: 952
Merged at revision: 909
Proposed branch: lp:~gerboland/unity-2d/shell-background-isolate
Merge into: lp:unity-2d
Diff against target: 207 lines (+117/-48)
3 files modified
shell/Shell.qml (+1/-1)
shell/common/Background.qml (+109/-0)
shell/dash/Dash.qml (+7/-47)
To merge this branch: bzr merge lp:~gerboland/unity-2d/shell-background-isolate
Reviewer Review Type Date Requested Status
Albert Astals Cid (community) Approve
MichaƂ Sawicz Pending
Tiago Salem Herrmann Pending
Review via email: mp+92693@code.launchpad.net

This proposal supersedes a proposal from 2012-01-31.

Description of the change

[shell] Change the Dash's Background into a standalone element.

To post a comment you must log in.
Revision history for this message
Albert Astals Cid (aacid) wrote : Posted in a previous version of this proposal

You have
  backgrounds.fill: parent
in two places that do the same, the Background item in Dash.qml and the root Item in Background.qml, not that it really matters, but maybe makes sense just having it in one place?

I'm a bit more concerned about the 39, 37 and 0, 0 for the margins when previously we just used content.anchors.bottomMargin and content.anchors.rightMargin, wouldn't it be better to introduce a property so you can assign it that way too?

review: Needs Fixing
Revision history for this message
Tiago Salem Herrmann (tiagosh) wrote : Posted in a previous version of this proposal

works fine and the code is clean.
thanks.

review: Approve
Revision history for this message
Florian Boucault (fboucault) wrote : Posted in a previous version of this proposal

Please resubmit the MR against lp:unity-2d

Revision history for this message
Albert Astals Cid (aacid) wrote :

Looks good to me

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'shell/Shell.qml'
2--- shell/Shell.qml 2012-02-10 17:03:01 +0000
3+++ shell/Shell.qml 2012-02-12 22:50:59 +0000
4@@ -164,7 +164,7 @@
5
6 InputShapeMask {
7 id: shape1
8- source: "shell/dash/artwork/desktop_dash_background_no_transparency.png"
9+ source: "shell/common/artwork/desktop_dash_background_no_transparency.png"
10 color: "red"
11 position: Qt.point(dashLoader.width - 50, dashLoader.height - 49)
12 enabled: declarativeView.dashMode == ShellDeclarativeView.DesktopMode
13
14=== added file 'shell/common/Background.qml'
15--- shell/common/Background.qml 1970-01-01 00:00:00 +0000
16+++ shell/common/Background.qml 2012-02-12 22:50:59 +0000
17@@ -0,0 +1,109 @@
18+/*
19+ * This file is part of unity-2d
20+ *
21+ * Copyright 2010-2011 Canonical Ltd.
22+ *
23+ * This program is free software; you can redistribute it and/or modify
24+ * it under the terms of the GNU General Public License as published by
25+ * the Free Software Foundation; version 3.
26+ *
27+ * This program is distributed in the hope that it will be useful,
28+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
29+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30+ * GNU General Public License for more details.
31+ *
32+ * You should have received a copy of the GNU General Public License
33+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
34+ */
35+
36+import QtQuick 1.1
37+import Unity2d 1.0
38+import Effects 1.0
39+
40+Item {
41+ id: background
42+ property bool active: false
43+ property bool fullscreen: false
44+ property int bottomBorderThickness
45+ property int rightBorderThickness
46+ /* coordinates of top left corner needed to capture correct segment of background */
47+ property int xPosition: 0
48+ property int yPosition: 0
49+
50+ /* Avoid redraw at rendering */
51+ effect: CacheEffect {}
52+
53+ Item {
54+ anchors.fill: parent
55+ anchors.bottomMargin: bottomBorderThickness
56+ anchors.rightMargin: rightBorderThickness
57+ clip: true
58+
59+ Image {
60+ id: blurredBackground
61+
62+ effect: Blur {blurRadius: 12}
63+
64+ /* 'source' needs to be set when this becomes visible, that is when active
65+ becomes true, so that a screenshot of the desktop is taken at that point.
66+ See http://doc.qt.nokia.com/4.7-snapshot/qml-image.html#cache-prop
67+ */
68+
69+ /* Use an image of the root window which essentially is a
70+ capture of the entire screen */
71+ source: active ? "image://window/root" : ""
72+ cache: false
73+
74+ fillMode: Image.PreserveAspectCrop
75+ x: -xPosition
76+ y: -yPosition
77+ }
78+
79+ Image {
80+ anchors.fill: parent
81+ fillMode: Image.PreserveAspectCrop
82+ source: "artwork/background_sheen.png"
83+ }
84+ }
85+
86+ BorderImage {
87+ id: border
88+
89+ /* Define properties of border here */
90+ property int bottomThickness: 39
91+ property int rightThickness: 37
92+
93+ anchors.fill: parent
94+ source: desktop.isCompositingManagerRunning ? "artwork/desktop_dash_background.sci" : "artwork/desktop_dash_background_no_transparency.sci"
95+ mirror: isRightToLeft()
96+ }
97+
98+ states: [
99+ State {
100+ name: "normal"
101+ when: !fullscreen
102+ PropertyChanges {
103+ target: background
104+ bottomBorderThickness: border.bottomThickness
105+ rightBorderThickness: border.rightThickness
106+ }
107+ PropertyChanges {
108+ target: border
109+ visible: true
110+ }
111+ },
112+ State {
113+ name: "fullscreen"
114+ when: fullscreen
115+ PropertyChanges {
116+ target: background
117+ bottomBorderThickness: 0
118+ rightBorderThickness: 0
119+ }
120+ PropertyChanges {
121+ target: border
122+ visible: false
123+ }
124+ }
125+ ]
126+}
127
128=== renamed file 'shell/dash/artwork/background_sheen.png' => 'shell/common/artwork/background_sheen.png'
129=== renamed file 'shell/dash/artwork/desktop_dash_background.png' => 'shell/common/artwork/desktop_dash_background.png'
130=== renamed file 'shell/dash/artwork/desktop_dash_background.sci' => 'shell/common/artwork/desktop_dash_background.sci'
131=== renamed file 'shell/dash/artwork/desktop_dash_background_no_transparency.png' => 'shell/common/artwork/desktop_dash_background_no_transparency.png'
132=== renamed file 'shell/dash/artwork/desktop_dash_background_no_transparency.sci' => 'shell/common/artwork/desktop_dash_background_no_transparency.sci'
133=== modified file 'shell/dash/Dash.qml'
134--- shell/dash/Dash.qml 2012-02-09 11:22:43 +0000
135+++ shell/dash/Dash.qml 2012-02-12 22:50:59 +0000
136@@ -211,55 +211,15 @@
137 }
138 }
139
140- Item {
141+ Background {
142 id: background
143
144 anchors.fill: parent
145
146- /* Avoid redraw at rendering */
147- effect: CacheEffect {}
148-
149- Item {
150- anchors.fill: parent
151- anchors.bottomMargin: content.anchors.bottomMargin
152- anchors.rightMargin: content.anchors.rightMargin
153- clip: true
154-
155- Image {
156- id: blurredBackground
157-
158- effect: Blur {blurRadius: 12}
159-
160- /* 'source' needs to be set when the dash becomes visible, that
161- is when dash.active becomes true, so that a
162- screenshot of the windows behind the dash is taken at that
163- point.
164- See http://doc.qt.nokia.com/4.7-snapshot/qml-image.html#cache-prop
165- */
166-
167- /* Use an image of the root window which essentially is a
168- capture of the entire screen */
169- source: dash.active ? "image://window/root" : ""
170- cache: false
171-
172- fillMode: Image.PreserveAspectCrop
173- x: -launcherLoader.width
174- y: -declarativeView.globalPosition.y
175- }
176-
177- Image {
178- anchors.fill: parent
179- fillMode: Image.PreserveAspectCrop
180- source: "artwork/background_sheen.png"
181- }
182- }
183-
184- BorderImage {
185- anchors.fill: parent
186- visible: declarativeView.dashMode == ShellDeclarativeView.DesktopMode
187- source: desktop.isCompositingManagerRunning ? "artwork/desktop_dash_background.sci" : "artwork/desktop_dash_background_no_transparency.sci"
188- mirror: isRightToLeft()
189- }
190+ active: dash.active
191+ fullscreen: declarativeView.dashMode != ShellDeclarativeView.DesktopMode
192+ xPosition: launcherLoader.width
193+ yPosition: declarativeView.globalPosition.y
194 }
195
196 Item {
197@@ -269,8 +229,8 @@
198 /* Margins in DesktopMode set so that the content does not overlap with
199 the border defined by the background image.
200 */
201- anchors.bottomMargin: declarativeView.dashMode == ShellDeclarativeView.DesktopMode ? 39 : 0
202- anchors.rightMargin: declarativeView.dashMode == ShellDeclarativeView.DesktopMode ? 37 : 0
203+ anchors.bottomMargin: background.bottomBorderThickness
204+ anchors.rightMargin: background.rightBorderThickness
205
206 /* Unhandled keys will always be forwarded to the search bar. That way
207 the user can type and search from anywhere in the interface without

Subscribers

People subscribed via source and target branches