2
* This file is part of unity-2d
4
* Copyright 2012 Canonical Ltd.
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; version 3.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
22
import "common/utils.js" as Utils
26
/* Space reserved by strutManager is taken off screen.availableGeometry but
27
we want the shell to take all the available space, including the one we
28
reserved ourselves via strutManager. */
29
height: declarativeView.screen.availableGeometry.height
30
width: declarativeView.screen.availableGeometry.width + (strutManager.enabled ? strutManager.width : 0)
32
Accessible.name: "shell"
36
anchors.top: parent.top
37
anchors.bottom: parent.bottom
40
if (Utils.isLeftToRight()) {
41
return visibilityController.shown ? 0 : -width
43
return visibilityController.shown ? shell.width - width : shell.width
47
KeyNavigation.right: dashLoader
50
target: launcherLoader.item
52
value: !dashLoader.item.active
55
Behavior on x { NumberAnimation { duration: 125 } }
58
target: declarativeView
59
onDashActiveChanged: {
60
if (declarativeView.dashActive) launcherLoader.visibilityController.beginForceVisible("dash")
62
launcherLoader.visibilityController.endForceVisible("dash")
63
if (dashLoader.status == Loader.Ready) dashLoader.item.deactivateAllLenses()
70
onShownChanged: if (shown) {
71
/* The the spread grabs input and Qt can't properly
72
detect we've lost input, so explicitly hide the menus */
73
launcherLoader.item.hideMenu()
74
launcherLoader.visibilityController.beginForceVisible("spread")
76
else launcherLoader.visibilityController.endForceVisible("spread")
83
source: "dash/Dash.qml"
84
anchors.top: parent.top
85
x: Utils.isLeftToRight() ? launcherLoader.width : shell.width - width - launcherLoader.width
86
onLoaded: item.focus = true
87
opacity: item.active ? 1.0 : 0.0
91
target: dashLoader.item
92
property: "fullscreenWidth"
93
value: shell.width - launcherLoader.width
98
target: declarativeView
99
onLauncherFocusRequested: {
100
launcherLoader.focus = true
101
launcherLoader.item.focusBFB()
104
/* FIXME: The launcher is forceVisible while it has activeFocus. However even though
105
the documentation says that setting focus=false will make an item lose activeFocus
106
if it has it, this doesn't happen with FocusScopes (and Launcher is a FocusScope).
107
Therefore I'm working around this by giving focus to the shell, which is safe since
108
the shell doesn't react to activeFocus at all.
109
See: https://bugreports.qt.nokia.com/browse/QTBUG-19688 */
110
if (!declarativeView.focus && launcherLoader.activeFocus) shell.focus = true
114
Component.onCompleted: declarativeView.show()
117
if (event.key == Qt.Key_Escape) {
118
declarativeView.forceDeactivateWindow()
123
target: declarativeView
125
InputShapeRectangle {
127
// FIXME: this results in a 1px wide white rectangle on the launcher edge, we should switch
128
// to cpp-based edge detection, and later XFixes barriers to get rid of that completely
129
var somewhatShown = Utils.isLeftToRight() ? -launcherLoader.x < launcherLoader.width : launcherLoader.x < shell.width
131
return Qt.rect(launcherLoader.x,
133
launcherLoader.width,
134
launcherLoader.height)
136
// The outerEdgeMouseArea is one pixel bigger on each side so use it
137
// when the launcher is hidden to have that extra pixel in the border
138
return Qt.rect(launcherLoader.x + launcherLoader.outerEdgeMouseArea.x,
140
launcherLoader.outerEdgeMouseArea.width,
141
launcherLoader.height)
144
enabled: launcherLoader.status == Loader.Ready
147
InputShapeRectangle {
148
rectangle: if (desktop.isCompositingManagerRunning) {
149
Qt.rect(dashLoader.x, dashLoader.y, dashLoader.width, dashLoader.height)
151
Qt.rect(dashLoader.x, dashLoader.y, dashLoader.width - 7, dashLoader.height - 9)
153
enabled: dashLoader.status == Loader.Ready && dashLoader.item.active
154
mirrorHorizontally: Utils.isRightToLeft()
158
source: "shell/dash/artwork/desktop_dash_background_no_transparency.png"
160
position: Qt.point(dashLoader.width - 50, dashLoader.height - 49)
161
enabled: declarativeView.dashMode == ShellDeclarativeView.DesktopMode
168
edge: Unity2dPanel.LeftEdge
169
widget: declarativeView
170
height: launcherLoader.height
171
width: launcherLoader.width
172
enabled: Utils.clamp(launcher2dConfiguration.hideMode, 0, 2) == 0