Merge lp:~fboucault/unity-2d/declarative_view_global_pos into lp:unity-2d/3.0

Proposed by Florian Boucault on 2011-08-09
Status: Merged
Approved by: Gerry Boland on 2011-08-09
Approved revision: 664
Merged at revision: 664
Proposed branch: lp:~fboucault/unity-2d/declarative_view_global_pos
Merge into: lp:unity-2d/3.0
Diff against target: 152 lines (+26/-10)
8 files modified
launcher/app/launcher.cpp (+1/-0)
libunity-2d-private/Unity2d/GnomeBackground.qml (+1/-1)
libunity-2d-private/src/unity2ddeclarativeview.cpp (+11/-0)
libunity-2d-private/src/unity2ddeclarativeview.h (+4/-0)
places/app/dashdeclarativeview.cpp (+5/-5)
places/app/places.cpp (+1/-0)
spread/Windows.qml (+2/-2)
spread/app/spread.cpp (+1/-2)
To merge this branch: bzr merge lp:~fboucault/unity-2d/declarative_view_global_pos
Reviewer Review Type Date Requested Status
Gerry Boland 2011-08-09 Approve on 2011-08-09
Review via email: mp+70880@code.launchpad.net

Description of the change

[dash] Properly position background wallpaper when using a non compositing window manager.

New Unity2DDeclarativeView::globalPosition property that cancels the need for using 'launcherMaximumWidth'.
Every QML based component (launcher, spread, dash) now exposes a 'declarativeView' variable.

To post a comment you must log in.
Gerry Boland (gerboland) wrote :

Looks good, in.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'launcher/app/launcher.cpp'
2--- launcher/app/launcher.cpp 2011-07-27 09:42:32 +0000
3+++ launcher/app/launcher.cpp 2011-08-09 13:43:21 +0000
4@@ -109,6 +109,7 @@
5 launcherView->engine()->addImportPath(unity2dDirectory() + "/libunity-2d-private/");
6 }
7
8+ launcherView->rootContext()->setContextProperty("declarativeView", launcherView);
9 launcherView->rootContext()->setContextProperty("launcherView", launcherView);
10 launcherView->rootContext()->setContextProperty("panel", &panel);
11 launcherView->rootContext()->setContextProperty("visibilityController", visibilityController);
12
13=== modified file 'libunity-2d-private/Unity2d/GnomeBackground.qml'
14--- libunity-2d-private/Unity2d/GnomeBackground.qml 2011-07-11 10:26:02 +0000
15+++ libunity-2d-private/Unity2d/GnomeBackground.qml 2011-08-09 13:43:21 +0000
16@@ -87,7 +87,7 @@
17 height: screen.geometry.height
18
19 smooth: true
20- x: screen.availableGeometry.x - launcherMaximumWidth
21+ x: screen.availableGeometry.x - declarativeView.globalPosition.x
22 y: -screen.availableGeometry.y
23
24 /* Possible modes are:
25
26=== modified file 'libunity-2d-private/src/unity2ddeclarativeview.cpp'
27--- libunity-2d-private/src/unity2ddeclarativeview.cpp 2011-08-05 15:14:04 +0000
28+++ libunity-2d-private/src/unity2ddeclarativeview.cpp 2011-08-09 13:43:21 +0000
29@@ -48,6 +48,11 @@
30 Q_EMIT transparentBackgroundChanged(transparentBackground);
31 }
32
33+QPoint Unity2DDeclarativeView::globalPosition() const
34+{
35+ return mapToGlobal(QPoint(0,0));
36+}
37+
38 void Unity2DDeclarativeView::setupViewport()
39 {
40 if (m_useOpenGL) {
41@@ -98,6 +103,12 @@
42 }
43 }
44
45+void Unity2DDeclarativeView::moveEvent(QMoveEvent* event)
46+{
47+ Q_EMIT globalPositionChanged(globalPosition());
48+}
49+
50+
51 /* Obtaining & Discarding Keyboard Focus for Window on Demand
52 *
53 * In the X world, activating a window means to give it the input (keyboard)
54
55=== modified file 'libunity-2d-private/src/unity2ddeclarativeview.h'
56--- libunity-2d-private/src/unity2ddeclarativeview.h 2011-08-01 11:58:35 +0000
57+++ libunity-2d-private/src/unity2ddeclarativeview.h 2011-08-09 13:43:21 +0000
58@@ -9,6 +9,7 @@
59
60 Q_PROPERTY(bool useOpenGL READ useOpenGL WRITE setUseOpenGL NOTIFY useOpenGLChanged)
61 Q_PROPERTY(bool transparentBackground READ transparentBackground WRITE setTransparentBackground NOTIFY transparentBackgroundChanged)
62+ Q_PROPERTY(QPoint globalPosition READ globalPosition NOTIFY globalPositionChanged)
63
64 public:
65 Unity2DDeclarativeView(QWidget *parent = 0);
66@@ -16,6 +17,7 @@
67 // getters
68 bool useOpenGL() const;
69 bool transparentBackground() const;
70+ QPoint globalPosition() const;
71
72 // setters
73 void setUseOpenGL(bool);
74@@ -24,9 +26,11 @@
75 Q_SIGNALS:
76 void useOpenGLChanged(bool);
77 void transparentBackgroundChanged(bool);
78+ void globalPositionChanged(QPoint);
79
80 protected:
81 void setupViewport();
82+ virtual void moveEvent(QMoveEvent* event);
83
84 protected Q_SLOTS:
85 void forceActivateWindow();
86
87=== modified file 'places/app/dashdeclarativeview.cpp'
88--- places/app/dashdeclarativeview.cpp 2011-07-28 11:10:37 +0000
89+++ places/app/dashdeclarativeview.cpp 2011-08-09 13:43:21 +0000
90@@ -174,15 +174,15 @@
91 m_launcherClient->endForceVisible();
92 activeChanged(false);
93 } else {
94+ if (m_mode == FullScreenMode) {
95+ fitToAvailableSpace();
96+ } else {
97+ resizeToDesktopModeSize();
98+ }
99 show();
100 raise();
101 // We need a delay, otherwise the window may not be visible when we try to activate it
102 QTimer::singleShot(0, this, SLOT(forceActivateWindow()));
103- if (m_mode == FullScreenMode) {
104- fitToAvailableSpace();
105- } else {
106- resizeToDesktopModeSize();
107- }
108 if (oldMode == HiddenMode) {
109 // Check old mode to ensure we do not call BeginForceVisible twice
110 // if we go from desktop to fullscreen mode
111
112=== modified file 'places/app/places.cpp'
113--- places/app/places.cpp 2011-07-18 13:47:29 +0000
114+++ places/app/places.cpp 2011-08-09 13:43:21 +0000
115@@ -65,6 +65,7 @@
116
117 /* Load the QML UI, focus and show the window */
118 view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
119+ view.rootContext()->setContextProperty("declarativeView", &view);
120 view.rootContext()->setContextProperty("dashView", &view);
121 view.setSource(QUrl("./dash.qml"));
122
123
124=== modified file 'spread/Windows.qml'
125--- spread/Windows.qml 2011-06-23 17:08:53 +0000
126+++ spread/Windows.qml 2011-08-09 13:43:21 +0000
127@@ -149,8 +149,8 @@
128 target: spreadWindow
129 /* Note that we subtract the availableGeometry x and y since window.location is
130 expressed in global screen coordinates. */
131- x: window.position.x - launcherMaximumWidth
132- y: window.position.y - screen.availableGeometry.y
133+ x: window.position.x - declarativeView.globalPosition.x
134+ y: window.position.y - declarativeView.globalPosition.y
135 width: window.size.width
136 height: window.size.height
137 animateFollow: false
138
139=== modified file 'spread/app/spread.cpp'
140--- spread/app/spread.cpp 2011-07-18 13:47:29 +0000
141+++ spread/app/spread.cpp 2011-08-09 13:43:21 +0000
142@@ -62,10 +62,9 @@
143 control.connect(&view, SIGNAL(visibleChanged(bool)), SLOT(setIsShown(bool)));
144 view.rootContext()->setContextProperty("control", &control);
145
146- view.rootContext()->setContextProperty("launcherMaximumWidth", LauncherClient::MaximumWidth);
147-
148 /* Load the QML UI, focus and show the window */
149 view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
150+ view.rootContext()->setContextProperty("declarativeView", &view);
151 view.rootContext()->setContextProperty("spreadView", &view);
152 view.setSource(QUrl("./Workspaces.qml"));
153

Subscribers

People subscribed via source and target branches