Merge lp:~aacid/unity-2d/unity-2d_move_alwaysFullScreen into lp:unity-2d

Proposed by Albert Astals Cid
Status: Merged
Approved by: Gerry Boland
Approved revision: 933
Merged at revision: 934
Proposed branch: lp:~aacid/unity-2d/unity-2d_move_alwaysFullScreen
Merge into: lp:unity-2d
Diff against target: 350 lines (+82/-46)
9 files modified
libunity-2d-private/src/dashclient.cpp (+15/-32)
libunity-2d-private/src/dashclient.h (+1/-2)
shell/app/dash.xml (+9/-0)
shell/app/dashdbus.cpp (+7/-0)
shell/app/dashdbus.h (+3/-0)
shell/app/shell.cpp (+0/-11)
shell/app/shelldeclarativeview.cpp (+40/-0)
shell/app/shelldeclarativeview.h (+6/-0)
shell/dash/Dash.qml (+1/-1)
To merge this branch: bzr merge lp:~aacid/unity-2d/unity-2d_move_alwaysFullScreen
Reviewer Review Type Date Requested Status
Gerry Boland (community) Approve
Review via email: mp+94382@code.launchpad.net

Description of the change

Move the alwaysFullScreen logic to the shellmanager. Make the DashClient just be a client

To post a comment you must log in.
Revision history for this message
Gerry Boland (gerboland) wrote :

Problem: Setting the dconf key com.canonical.unity-2d.formFactor to "tv" is not cuaing Dash to open fullscreen.

Only one minor thing:

+ <signal name="activeLensChanged"

is adding a rogue space.

932. By Albert Astals Cid

Remove spac change

933. By Albert Astals Cid

Rename to the proper name

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

Both fixed

Revision history for this message
Gerry Boland (gerboland) wrote :

Looks good, thank you

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libunity-2d-private/src/dashclient.cpp'
2--- libunity-2d-private/src/dashclient.cpp 2012-02-09 02:44:32 +0000
3+++ libunity-2d-private/src/dashclient.cpp 2012-02-23 15:36:24 +0000
4@@ -40,9 +40,6 @@
5 static const char* DASH_DBUS_PATH = "/Dash";
6 static const char* DASH_DBUS_INTERFACE = "com.canonical.Unity2d.Dash";
7
8-static const int DASH_MIN_SCREEN_WIDTH = 1280;
9-static const int DASH_MIN_SCREEN_HEIGHT = 1084;
10-
11 DashClient::DashClient(QObject* parent)
12 : QObject(parent)
13 , m_dashDbusIface(0)
14@@ -66,15 +63,6 @@
15 this);
16 connect(watcher, SIGNAL(serviceRegistered(QString)), SLOT(connectToDash()));
17 }
18-
19- connect(QApplication::desktop(), SIGNAL(resized(int)), SLOT(updateAlwaysFullScreen()));
20-
21- // FIXME: we need to use a queued connection here otherwise QConf will deadlock for some reason
22- // when we read any property from the slot (which we need to do). We need to check why this
23- // happens and report a bug to dconf-qt to get it fixed.
24- connect(&unity2dConfiguration(), SIGNAL(formFactorChanged(QString)),
25- SLOT(updateAlwaysFullScreen()), Qt::QueuedConnection);
26- updateAlwaysFullScreen();
27 }
28
29 void DashClient::connectToDash()
30@@ -87,6 +75,8 @@
31 QDBusConnection::sessionBus(), this);
32 connect(m_dashDbusIface, SIGNAL(activeChanged(bool)),
33 SLOT(slotDashActiveChanged(bool)));
34+ connect(m_dashDbusIface, SIGNAL(alwaysFullScreenChanged(bool)),
35+ SLOT(slotAlwaysFullScreenChanged(bool)));
36
37 QVariant value = m_dashDbusIface->property("active");
38 if (value.isValid()) {
39@@ -94,6 +84,13 @@
40 } else {
41 UQ_WARNING << "Fetching Dash.active property failed";
42 }
43+
44+ value = m_dashDbusIface->property("alwaysFullScreen");
45+ if (value.isValid()) {
46+ m_alwaysFullScreen = value.toBool();
47+ } else {
48+ UQ_WARNING << "Fetching Dash.alwaysFullScreen property failed";
49+ }
50 }
51
52 DashClient* DashClient::instance()
53@@ -128,26 +125,12 @@
54 }
55 }
56
57-QSize DashClient::minimumSizeForDesktop()
58-{
59- return QSize(DASH_MIN_SCREEN_WIDTH, DASH_MIN_SCREEN_HEIGHT);
60-}
61-
62-void DashClient::updateAlwaysFullScreen()
63-{
64- bool alwaysFullScreen;
65- if (unity2dConfiguration().property("formFactor").toString() != "desktop") {
66- alwaysFullScreen = true;
67- } else {
68- QRect rect = QApplication::desktop()->screenGeometry(QPoint());
69- QSize minSize = minimumSizeForDesktop();
70- alwaysFullScreen = rect.width() < minSize.width() && rect.height() < minSize.height();
71- }
72-
73- if (m_alwaysFullScreen != alwaysFullScreen) {
74- m_alwaysFullScreen = alwaysFullScreen;
75- Q_EMIT alwaysFullScreenChanged();
76- }
77+void DashClient::slotAlwaysFullScreenChanged(bool value)
78+{
79+ if (m_alwaysFullScreen != value) {
80+ m_alwaysFullScreen = value;
81+ }
82+ Q_EMIT alwaysFullScreenChanged();
83 }
84
85 bool DashClient::alwaysFullScreen() const
86
87=== modified file 'libunity-2d-private/src/dashclient.h'
88--- libunity-2d-private/src/dashclient.h 2012-02-09 02:44:32 +0000
89+++ libunity-2d-private/src/dashclient.h 2012-02-23 15:36:24 +0000
90@@ -45,7 +45,6 @@
91 void setActive(bool active);
92
93 bool alwaysFullScreen() const;
94- static QSize minimumSizeForDesktop();
95
96 Q_SIGNALS:
97 void activeChanged(bool);
98@@ -54,7 +53,7 @@
99 private Q_SLOTS:
100 void connectToDash();
101 void slotDashActiveChanged(bool);
102- void updateAlwaysFullScreen();
103+ void slotAlwaysFullScreenChanged(bool);
104
105 private:
106 DashClient(QObject* parent = 0);
107
108=== modified file 'shell/app/dash.xml'
109--- shell/app/dash.xml 2012-02-09 11:07:00 +0000
110+++ shell/app/dash.xml 2012-02-23 15:36:24 +0000
111@@ -21,6 +21,9 @@
112 <property name="active" type="b" access="readwrite">
113 <dox:d>True if the Dash is active</dox:d>
114 </property>
115+ <property name="alwaysFullScreen" type="b" access="read">
116+ <dox:d>True if the Dash has to be in full screen mode</dox:d>
117+ </property>
118 <property name="activeLens" type="s" access="readwrite">
119 <dox:d>The currently active lens</dox:d>
120 </property>
121@@ -30,6 +33,12 @@
122 <dox:d>True if the Dash is active</dox:d>
123 </arg>
124 </signal>
125+ <signal name="alwaysFullScreenChanged">
126+ <dox:d>Signals when the alwaysFullScreen status of the Dash changes</dox:d>
127+ <arg name="active" type="b" direction="out">
128+ <dox:d>True if the Dash has to be in full screen mode</dox:d>
129+ </arg>
130+ </signal>
131 <signal name="activeLensChanged">
132 <dox:d>Signals when the currently lens in the Dash changes</dox:d>
133 <arg name="activeLens" type="s" direction="out">
134
135=== modified file 'shell/app/dashdbus.cpp'
136--- shell/app/dashdbus.cpp 2012-02-09 11:07:00 +0000
137+++ shell/app/dashdbus.cpp 2012-02-23 15:36:24 +0000
138@@ -34,6 +34,7 @@
139 , m_view(view)
140 {
141 connect(m_view, SIGNAL(dashActiveChanged(bool)), SIGNAL(activeChanged(bool)));
142+ connect(m_view, SIGNAL(dashAlwaysFullScreenChanged(bool)), SIGNAL(alwaysFullScreenChanged(bool)));
143 connect(m_view, SIGNAL(activeLensChanged(QString)), SIGNAL(activeLensChanged(QString)));
144 }
145
146@@ -79,6 +80,12 @@
147 m_view->setDashActive(active);
148 }
149
150+bool
151+DashDBus::alwaysFullScreen() const
152+{
153+ return m_view->dashAlwaysFullScreen();
154+}
155+
156 QString
157 DashDBus::activeLens() const
158 {
159
160=== modified file 'shell/app/dashdbus.h'
161--- shell/app/dashdbus.h 2012-02-09 11:07:00 +0000
162+++ shell/app/dashdbus.h 2012-02-23 15:36:24 +0000
163@@ -35,6 +35,7 @@
164 {
165 Q_OBJECT
166 Q_PROPERTY(bool active READ active WRITE setActive NOTIFY activeChanged)
167+ Q_PROPERTY(bool alwaysFullScreen READ alwaysFullScreen NOTIFY alwaysFullScreenChanged)
168 Q_PROPERTY(QString activeLens READ activeLens WRITE setActiveLens NOTIFY activeLensChanged)
169
170 public:
171@@ -45,6 +46,7 @@
172
173 bool active() const;
174 void setActive(bool active);
175+ bool alwaysFullScreen() const;
176 QString activeLens() const;
177 void setActiveLens(QString activeLens);
178
179@@ -54,6 +56,7 @@
180
181 Q_SIGNALS:
182 void activeChanged(bool);
183+ void alwaysFullScreenChanged(bool);
184 void activeLensChanged(QString);
185
186 private:
187
188=== modified file 'shell/app/shell.cpp'
189--- shell/app/shell.cpp 2012-02-23 10:13:49 +0000
190+++ shell/app/shell.cpp 2012-02-23 15:36:24 +0000
191@@ -42,7 +42,6 @@
192 // Local
193 #include "config.h"
194 #include "shelldeclarativeview.h"
195-#include "dashclient.h"
196 #include "dashdbus.h"
197
198 int main(int argc, char *argv[])
199@@ -85,16 +84,6 @@
200 /* Load the QML UI, focus and show the window */
201 view.setResizeMode(QDeclarativeView::SizeViewToRootObject);
202 view.rootContext()->setContextProperty("declarativeView", &view);
203- // WARNING This declaration of dashClient used to be in Unity2d/plugin.cpp
204- // but it lead to locks when both the shell and the spread were started
205- // at the same time since SpreadMonitor QDBusServiceWatcher::serviceRegistered
206- // and DashClient QDBusServiceWatcher::serviceRegistered
207- // triggered at the same time ending up with both creating QDBusInterface
208- // to eachother in the main thread meaning they would block
209- // In case you need to have a DashClient in the spread the fix for the problem
210- // is moving the QDbusInterface creation to a thread so it does not block
211- // the main thread
212- view.rootContext()->setContextProperty("dashClient", DashClient::instance());
213 view.setSource(rootFileUrl);
214
215 /* Unset DESKTOP_AUTOSTART_ID in order to avoid child processes (launched
216
217=== modified file 'shell/app/shelldeclarativeview.cpp'
218--- shell/app/shelldeclarativeview.cpp 2012-02-13 23:46:04 +0000
219+++ shell/app/shelldeclarativeview.cpp 2012-02-23 15:36:24 +0000
220@@ -51,12 +51,16 @@
221
222 static const char* COMMANDS_LENS_ID = "commands.lens";
223
224+static const int DASH_MIN_SCREEN_WIDTH = 1280;
225+static const int DASH_MIN_SCREEN_HEIGHT = 1084;
226+
227 ShellDeclarativeView::ShellDeclarativeView()
228 : Unity2DDeclarativeView()
229 , m_mode(DesktopMode)
230 , m_expanded(true)
231 , m_active(false)
232 , m_superKeyPressed(false)
233+ , m_dashAlwaysFullScreen(false)
234 , m_superKeyHeld(false)
235 {
236 setAttribute(Qt::WA_X11NetWmWindowTypeDock, true);
237@@ -90,6 +94,15 @@
238
239 connect(m_screenInfo, SIGNAL(availableGeometryChanged(QRect)), SLOT(updateShellPosition()));
240 updateShellPosition();
241+
242+ // FIXME: we need to use a queued connection here otherwise QConf will deadlock for some reason
243+ // when we read any property from the slot (which we need to do). We need to check why this
244+ // happens and report a bug to dconf-qt to get it fixed.
245+ connect(&unity2dConfiguration(), SIGNAL(formFactorChanged(QString)),
246+ SLOT(updateDashAlwaysFullScreen()), Qt::QueuedConnection);
247+ connect(QApplication::desktop(), SIGNAL(resized(int)), SLOT(updateDashAlwaysFullScreen()));
248+
249+ updateDashAlwaysFullScreen();
250 }
251
252 void
253@@ -229,6 +242,11 @@
254 return m_expanded;
255 }
256
257+bool ShellDeclarativeView::dashAlwaysFullScreen() const
258+{
259+ return m_dashAlwaysFullScreen;
260+}
261+
262 void
263 ShellDeclarativeView::setActiveLens(const QString& activeLens)
264 {
265@@ -279,6 +297,28 @@
266 }
267 }
268
269+static QSize minimumSizeForDesktop()
270+{
271+ return QSize(DASH_MIN_SCREEN_WIDTH, DASH_MIN_SCREEN_HEIGHT);
272+}
273+
274+void ShellDeclarativeView::updateDashAlwaysFullScreen()
275+{
276+ bool dashAlwaysFullScreen;
277+ if (unity2dConfiguration().property("formFactor").toString() != "desktop") {
278+ dashAlwaysFullScreen = true;
279+ } else {
280+ const QRect rect = m_screenInfo->geometry();
281+ const QSize minSize = minimumSizeForDesktop();
282+ dashAlwaysFullScreen = rect.width() < minSize.width() && rect.height() < minSize.height();
283+ }
284+
285+ if (m_dashAlwaysFullScreen != dashAlwaysFullScreen) {
286+ m_dashAlwaysFullScreen = dashAlwaysFullScreen;
287+ Q_EMIT dashAlwaysFullScreenChanged(dashAlwaysFullScreen);
288+ }
289+}
290+
291 /* ----------------- super key handling ---------------- */
292
293 void
294
295=== modified file 'shell/app/shelldeclarativeview.h'
296--- shell/app/shelldeclarativeview.h 2012-02-23 10:13:49 +0000
297+++ shell/app/shelldeclarativeview.h 2012-02-23 15:36:24 +0000
298@@ -38,6 +38,7 @@
299 Q_PROPERTY(DashMode dashMode READ dashMode WRITE setDashMode NOTIFY dashModeChanged)
300 Q_PROPERTY(QString activeLens READ activeLens WRITE setActiveLens NOTIFY activeLensChanged)
301 Q_PROPERTY(bool focus READ hasFocus NOTIFY focusChanged) // overridden to add notify
302+ Q_PROPERTY(bool dashAlwaysFullScreen READ dashAlwaysFullScreen NOTIFY dashAlwaysFullScreenChanged)
303 Q_PROPERTY(bool superKeyHeld READ superKeyHeld NOTIFY superKeyHeldChanged)
304 Q_PROPERTY(bool haveCustomHomeShortcuts READ haveCustomHomeShortcuts)
305
306@@ -64,6 +65,7 @@
307 DashMode dashMode() const;
308 const QString& activeLens() const;
309 bool expanded() const;
310+ bool dashAlwaysFullScreen() const;
311 bool superKeyHeld() const { return m_superKeyHeld; }
312 QRect monitoredArea() const;
313 bool monitoredAreaContainsMouse() const;
314@@ -88,6 +90,7 @@
315 void monitoredAreaChanged();
316 void monitoredAreaContainsMouseChanged();
317
318+ void dashAlwaysFullScreenChanged(bool dashAlwaysFullScreen);
319 void superKeyHeldChanged(bool superKeyHeld);
320 void superKeyTapped();
321 void activateShortcutPressed(int itemIndex);
322@@ -105,6 +108,8 @@
323 void showCommandsLens();
324 void onAltF1Pressed();
325
326+ void updateDashAlwaysFullScreen();
327+
328 protected:
329 virtual void showEvent(QShowEvent *event);
330 virtual void mouseMoveEvent(QMouseEvent *event);
331@@ -126,6 +131,7 @@
332 bool m_active;
333
334 bool m_superKeyPressed;
335+ bool m_dashAlwaysFullScreen;
336 bool m_superKeyHeld;
337 bool m_superPressIgnored;
338 QTimer m_superKeyHoldTimer;
339
340=== modified file 'shell/dash/Dash.qml'
341--- shell/dash/Dash.qml 2012-02-16 23:25:25 +0000
342+++ shell/dash/Dash.qml 2012-02-23 15:36:24 +0000
343@@ -64,7 +64,7 @@
344 Binding {
345 target: declarativeView
346 property: "dashMode"
347- value: dashClient.alwaysFullScreen || dash2dConfiguration.fullScreen ?
348+ value: declarativeView.dashAlwaysFullScreen || dash2dConfiguration.fullScreen ?
349 ShellDeclarativeView.FullScreenMode : ShellDeclarativeView.DesktopMode
350 }
351

Subscribers

People subscribed via source and target branches