1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
/*
* This file is part of unity-2d
*
* Copyright 2010-2011 Canonical Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 1.1
import Unity2d 1.0
import Effects 1.0
import "utils.js" as Utils
Item {
id: background
property bool active: false
property bool fullscreen: false
property int bottomBorderThickness
property int rightBorderThickness
property bool activeTriggerHelper: true
property bool reallyActive: active && activeTriggerHelper
property variant view: undefined
function trigger()
{
activeTriggerHelper = false
activeTriggerHelper = true
}
/* Avoid redraw at rendering */
effect: CacheEffect {}
Item {
anchors.fill: parent
anchors.bottomMargin: bottomBorderThickness
anchors.rightMargin: rightBorderThickness
clip: true
/* Extra Item seemingly unnecessary but actually useful to avoid a
redrawing bug that happens when applying an effect on a clipped item.
In this particular case, doing the Colorize on the clipped child item
would prevent proper repainting when maximizing then unmaximizing the
dash.
*/
effect: ColorizeEffect {
color: unityConfiguration.averageBgColor
saturation: 0.4
}
Image {
id: blurredBackground
effect: Blur {blurRadius: 12}
/* 'source' needs to be set when this becomes visible, that is when active
becomes true, so that a screenshot of the desktop is taken at that point.
See http://doc.qt.nokia.com/4.7-snapshot/qml-image.html#cache-prop
*/
/* Use an image of the root window which essentially is a
capture of the entire screen */
source: reallyActive ? "image://window/root" : ""
cache: false
fillMode: Image.PreserveAspectCrop
/* Place the screenshot of the desktop background on top of the desktop background,
no matter where the DeclarativeView or the parent object are placed.
*/
property variant origin: parent.mapFromItem(null, background.view != undefined ? -background.view.globalPosition.x : -declarativeView.globalPosition.x,
background.view != undefined ? -background.view.globalPosition.y : -declarativeView.globalPosition.y)
x: origin.x
y: origin.y
}
Image {
anchors.fill: parent
fillMode: Image.PreserveAspectCrop
source: "artwork/background_sheen.png"
opacity: 0.8
}
}
BorderImage {
id: border
/* Define properties of border here */
property int bottomThickness: 39
property int rightThickness: 37
anchors.fill: parent
source: desktop.isCompositingManagerRunning ? "artwork/desktop_dash_background.sci" : "artwork/desktop_dash_background_no_transparency.sci"
mirror: Utils.isRightToLeft()
}
states: [
State {
name: "normal"
when: !fullscreen
PropertyChanges {
target: background
bottomBorderThickness: border.bottomThickness
rightBorderThickness: border.rightThickness
}
PropertyChanges {
target: border
visible: true
}
},
State {
name: "fullscreen"
when: fullscreen
PropertyChanges {
target: background
bottomBorderThickness: 0
rightBorderThickness: 0
}
PropertyChanges {
target: border
visible: false
}
}
]
}
|