Merge lp:~azzar1/unity/lp-1136447 into lp:unity

Proposed by Andrea Azzarone
Status: Merged
Approved by: Brandon Schaefer
Approved revision: no longer in the source branch.
Merged at revision: 3185
Proposed branch: lp:~azzar1/unity/lp-1136447
Merge into: lp:unity
Diff against target: 338 lines (+114/-19)
12 files modified
dash/DashController.cpp (+9/-3)
hud/HudController.cpp (+9/-3)
launcher/BFBLauncherIcon.cpp (+2/-1)
launcher/HudLauncherIcon.cpp (+2/-1)
launcher/Launcher.cpp (+4/-2)
panel/PanelView.cpp (+11/-4)
panel/PanelView.h (+2/-0)
plugins/unityshell/src/unityshell.cpp (+2/-1)
tests/CMakeLists.txt (+1/-0)
tests/test_panel_view.cpp (+66/-0)
unity-shared/UBusMessages.h (+2/-2)
unity-shared/WindowButtons.cpp (+4/-2)
To merge this branch: bzr merge lp:~azzar1/unity/lp-1136447
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Brandon Schaefer (community) Approve
Review via email: mp+151624@code.launchpad.net

Commit message

Fix panel gradient on start up.

Description of the change

== Problem ==
On start up the Hud draws the panel gradient incorrectly.

== Fix ==
Set stored_dash_width_ when an overlay is opened too.

== Test ==
Unit test added.

To post a comment you must log in.
Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

Looks good to me test pass and confirms fixes the problem :)

review: Approve
Revision history for this message
Brandon Schaefer (brandontschaefer) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Brandon Schaefer (brandontschaefer) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'dash/DashController.cpp'
2--- dash/DashController.cpp 2013-01-30 02:11:19 +0000
3+++ dash/DashController.cpp 2013-03-04 23:58:20 +0000
4@@ -165,7 +165,9 @@
5 unity::glib::String overlay_identity;
6 gboolean can_maximise = FALSE;
7 gint32 overlay_monitor = 0;
8- g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING, &overlay_identity, &can_maximise, &overlay_monitor);
9+ int width = 0;
10+ int height = 0;
11+ g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING, &overlay_identity, &can_maximise, &overlay_monitor, &width, &height);
12
13 // hide if something else is coming up
14 if (overlay_identity.Str() != "dash")
15@@ -314,7 +316,9 @@
16
17 StartShowHideTimeline();
18
19- GVariant* info = g_variant_new(UBUS_OVERLAY_FORMAT_STRING, "dash", TRUE, monitor_);
20+ nux::Geometry const& view_content_geo = view_->GetContentGeometry();
21+
22+ GVariant* info = g_variant_new(UBUS_OVERLAY_FORMAT_STRING, "dash", TRUE, monitor_, view_content_geo.width, view_content_geo.height);
23 ubus_manager_.SendMessage(UBUS_OVERLAY_SHOWN, info);
24 }
25
26@@ -363,7 +367,9 @@
27
28 StartShowHideTimeline();
29
30- GVariant* info = g_variant_new(UBUS_OVERLAY_FORMAT_STRING, "dash", TRUE, monitor_);
31+ nux::Geometry const& view_content_geo = view_->GetContentGeometry();
32+
33+ GVariant* info = g_variant_new(UBUS_OVERLAY_FORMAT_STRING, "dash", TRUE, monitor_, view_content_geo.width, view_content_geo.height);
34 ubus_manager_.SendMessage(UBUS_OVERLAY_HIDDEN, info);
35 }
36
37
38=== modified file 'hud/HudController.cpp'
39--- hud/HudController.cpp 2013-01-17 21:39:37 +0000
40+++ hud/HudController.cpp 2013-03-04 23:58:20 +0000
41@@ -86,7 +86,8 @@
42 unity::glib::String overlay_identity;
43 gboolean can_maximise = FALSE;
44 gint32 overlay_monitor = 0;
45- g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING, &overlay_identity, &can_maximise, &overlay_monitor);
46+ int width, height;
47+ g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING, &overlay_identity, &can_maximise, &overlay_monitor, &width, &height);
48
49 if (overlay_identity.Str() != "hud")
50 {
51@@ -372,7 +373,10 @@
52 // hide the launcher
53 GVariant* message_data = g_variant_new("(b)", TRUE);
54 ubus.SendMessage(UBUS_LAUNCHER_LOCK_HIDE, message_data);
55- GVariant* info = g_variant_new(UBUS_OVERLAY_FORMAT_STRING, "hud", FALSE, monitor_index_);
56+
57+ auto const& view_content_geometry = view_->GetContentGeometry();
58+ GVariant* info = g_variant_new(UBUS_OVERLAY_FORMAT_STRING, "hud", FALSE, monitor_index_,
59+ view_content_geometry.width, view_content_geometry.height);
60 ubus.SendMessage(UBUS_OVERLAY_SHOWN, info);
61
62 nux::GetWindowCompositor().SetKeyFocusArea(view_->default_focus());
63@@ -416,7 +420,9 @@
64 GVariant* message_data = g_variant_new("(b)", FALSE);
65 ubus.SendMessage(UBUS_LAUNCHER_LOCK_HIDE, message_data);
66
67- GVariant* info = g_variant_new(UBUS_OVERLAY_FORMAT_STRING, "hud", FALSE, monitor_index_);
68+ auto const& view_content_geometry = view_->GetContentGeometry();
69+ GVariant* info = g_variant_new(UBUS_OVERLAY_FORMAT_STRING, "hud", FALSE, monitor_index_,
70+ view_content_geometry.width, view_content_geometry.height);
71 ubus.SendMessage(UBUS_OVERLAY_HIDDEN, info);
72 }
73
74
75=== modified file 'launcher/BFBLauncherIcon.cpp'
76--- launcher/BFBLauncherIcon.cpp 2012-12-14 13:41:50 +0000
77+++ launcher/BFBLauncherIcon.cpp 2013-03-04 23:58:20 +0000
78@@ -58,8 +58,9 @@
79 unity::glib::String overlay_identity;
80 gboolean can_maximise = FALSE;
81 gint32 overlay_monitor = 0;
82+ int width, height;
83 g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING,
84- &overlay_identity, &can_maximise, &overlay_monitor);
85+ &overlay_identity, &can_maximise, &overlay_monitor, &width, &height);
86
87 if (overlay_identity.Str() == "dash" && IsVisibleOnMonitor(overlay_monitor))
88 {
89
90=== modified file 'launcher/HudLauncherIcon.cpp'
91--- launcher/HudLauncherIcon.cpp 2012-11-06 18:19:09 +0000
92+++ launcher/HudLauncherIcon.cpp 2013-03-04 23:58:20 +0000
93@@ -89,8 +89,9 @@
94 unity::glib::String overlay_identity;
95 gboolean can_maximise = FALSE;
96 gint32 overlay_monitor = 0;
97+ int width, height;
98 g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING,
99- &overlay_identity, &can_maximise, &overlay_monitor);
100+ &overlay_identity, &can_maximise, &overlay_monitor, &width, &height);
101
102 // If the hud is open, we show the HUD button if we have a locked launcher
103 if (overlay_identity.Str() == "hud" &&
104
105=== modified file 'launcher/Launcher.cpp'
106--- launcher/Launcher.cpp 2013-02-11 22:03:56 +0000
107+++ launcher/Launcher.cpp 2013-03-04 23:58:20 +0000
108@@ -1210,8 +1210,9 @@
109 unity::glib::String overlay_identity;
110 gboolean can_maximise = FALSE;
111 gint32 overlay_monitor = 0;
112+ int width, height;
113 g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING,
114- &overlay_identity, &can_maximise, &overlay_monitor);
115+ &overlay_identity, &can_maximise, &overlay_monitor, &width, &height);
116 std::string identity(overlay_identity.Str());
117
118 LOG_DEBUG(logger) << "Overlay shown: " << identity
119@@ -1251,8 +1252,9 @@
120 unity::glib::String overlay_identity;
121 gboolean can_maximise = FALSE;
122 gint32 overlay_monitor = 0;
123+ int width, height;
124 g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING,
125- &overlay_identity, &can_maximise, &overlay_monitor);
126+ &overlay_identity, &can_maximise, &overlay_monitor, &width, &height);
127
128 std::string identity = overlay_identity.Str();
129
130
131=== modified file 'panel/PanelView.cpp'
132--- panel/PanelView.cpp 2013-02-08 20:23:28 +0000
133+++ panel/PanelView.cpp 2013-03-04 23:58:20 +0000
134@@ -115,8 +115,7 @@
135 ubus_manager_.RegisterInterest(UBUS_BACKGROUND_COLOR_CHANGED, sigc::mem_fun(this, &PanelView::OnBackgroundUpdate));
136 ubus_manager_.RegisterInterest(UBUS_OVERLAY_HIDDEN, sigc::mem_fun(this, &PanelView::OnOverlayHidden));
137 ubus_manager_.RegisterInterest(UBUS_OVERLAY_SHOWN, sigc::mem_fun(this, &PanelView::OnOverlayShown));
138- ubus_manager_.RegisterInterest(UBUS_DASH_SIZE_CHANGED, [&] (GVariant *data)
139- {
140+ ubus_manager_.RegisterInterest(UBUS_DASH_SIZE_CHANGED, [&] (GVariant *data) {
141 int width, height;
142 g_variant_get(data, "(ii)", &width, &height);
143 stored_dash_width_ = width;
144@@ -197,8 +196,9 @@
145 unity::glib::String overlay_identity;
146 gboolean can_maximise = FALSE;
147 gint32 overlay_monitor = 0;
148+ int width, height;
149 g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING,
150- &overlay_identity, &can_maximise, &overlay_monitor);
151+ &overlay_identity, &can_maximise, &overlay_monitor, &width, &height);
152
153 if (monitor_ == overlay_monitor && overlay_identity.Str() == active_overlay_)
154 {
155@@ -219,11 +219,13 @@
156 unity::glib::String overlay_identity;
157 gboolean can_maximise = FALSE;
158 gint32 overlay_monitor = 0;
159+ int width, height;
160 g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING,
161- &overlay_identity, &can_maximise, &overlay_monitor);
162+ &overlay_identity, &can_maximise, &overlay_monitor, &width, &height);
163
164 if (monitor_ == overlay_monitor)
165 {
166+ stored_dash_width_ = width;
167 bg_effect_helper_.enabled = true;
168 active_overlay_ = overlay_identity.Str();
169 overlay_is_open_ = true;
170@@ -787,4 +789,9 @@
171 return menu_view_->GetControlsActive();
172 }
173
174+int PanelView::GetStoredDashWidth() const
175+{
176+ return stored_dash_width_;
177+}
178+
179 } // namespace unity
180
181=== modified file 'panel/PanelView.h'
182--- panel/PanelView.h 2013-01-30 19:00:01 +0000
183+++ panel/PanelView.h 2013-03-04 23:58:20 +0000
184@@ -23,6 +23,7 @@
185 #include <vector>
186 #include <memory>
187
188+#include <Nux/Nux.h>
189 #include <Nux/View.h>
190 #include <Nux/TextureArea.h>
191 #include <NuxGraphics/GraphicsEngine.h>
192@@ -63,6 +64,7 @@
193 int discovery_fadein, int discovery_fadeout);
194
195 Window GetTrayXid() const;
196+ int GetStoredDashWidth() const;
197
198 void SetLauncherWidth(int width);
199
200
201=== modified file 'plugins/unityshell/src/unityshell.cpp'
202--- plugins/unityshell/src/unityshell.cpp 2013-02-27 09:53:12 +0000
203+++ plugins/unityshell/src/unityshell.cpp 2013-03-04 23:58:20 +0000
204@@ -392,8 +392,9 @@
205 unity::glib::String overlay_identity;
206 gboolean can_maximise = FALSE;
207 gint32 overlay_monitor = 0;
208+ int width, height;
209 g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING,
210- &overlay_identity, &can_maximise, &overlay_monitor);
211+ &overlay_identity, &can_maximise, &overlay_monitor, &width, &height);
212
213 overlay_monitor_ = overlay_monitor;
214
215
216=== modified file 'tests/CMakeLists.txt'
217--- tests/CMakeLists.txt 2013-02-15 00:49:35 +0000
218+++ tests/CMakeLists.txt 2013-03-04 23:58:20 +0000
219@@ -219,6 +219,7 @@
220 test_panel_menu_view.cpp
221 test_panel_style.cpp
222 test_panel_tray.cpp
223+ test_panel_view.cpp
224 test_places_group.cpp
225 test_previews_application.cpp
226 test_previews_generic.cpp
227
228=== added file 'tests/test_panel_view.cpp'
229--- tests/test_panel_view.cpp 1970-01-01 00:00:00 +0000
230+++ tests/test_panel_view.cpp 2013-03-04 23:58:20 +0000
231@@ -0,0 +1,66 @@
232+/*
233+ * Copyright 2013 Canonical Ltd.
234+ *
235+ * This program is free software: you can redistribute it and/or modify it
236+ * under the terms of the GNU General Public License version 3, as published
237+ * by the Free Software Foundation.
238+ *
239+ * This program is distributed in the hope that it will be useful, but
240+ * WITHOUT ANY WARRANTY; without even the implied warranties of
241+ * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
242+ * PURPOSE. See the GNU General Public License for more details.
243+ *
244+ * You should have received a copy of the GNU General Public License
245+ * version 3 along with this program. If not, see
246+ * <http://www.gnu.org/licenses/>
247+ *
248+ * Authored by: Andrea Azzarone <andrea.azzarone@canonical.com>
249+ *
250+ */
251+
252+#include <gtest/gtest.h>
253+
254+#include "PanelView.h"
255+#include "unity-shared/PanelStyle.h"
256+#include "unity-shared/UBusMessages.h"
257+#include "unity-shared/UBusWrapper.h"
258+#include "unity-shared/UnitySettings.h"
259+#include "test_utils.h"
260+
261+namespace
262+{
263+
264+class TestPanelView : public testing::Test
265+{
266+public:
267+ unity::Settings unity_settings_;
268+ unity::panel::Style panel_style_;
269+ unity::UBusManager ubus_manager_;
270+ nux::ObjectPtr<unity::PanelView> panel_view_;
271+
272+ TestPanelView()
273+ : panel_view_(new unity::PanelView())
274+ {}
275+
276+};
277+
278+TEST_F(TestPanelView, StoredDashWidth)
279+{
280+ auto check_function = [this] (int value) {
281+ return panel_view_->GetStoredDashWidth() == value;
282+ };
283+
284+ int width = 500;
285+ int height = 600;
286+
287+ GVariant* info = g_variant_new(UBUS_OVERLAY_FORMAT_STRING, "dash", TRUE, 0, width, height);
288+ ubus_manager_.SendMessage(UBUS_OVERLAY_SHOWN, info);
289+ Utils::WaitUntil(std::bind(check_function, width));
290+
291+ width = 150;
292+
293+ ubus_manager_.SendMessage(UBUS_DASH_SIZE_CHANGED, g_variant_new("(ii)", width, height));
294+ Utils::WaitUntil(std::bind(check_function, width));
295+}
296+
297+}
298
299=== modified file 'unity-shared/UBusMessages.h'
300--- unity-shared/UBusMessages.h 2012-12-17 09:28:31 +0000
301+++ unity-shared/UBusMessages.h 2013-03-04 23:58:20 +0000
302@@ -35,8 +35,8 @@
303 #define UBUS_DASH_ABOUT_TO_SHOW "DASH_ABOUT_TO_SHOW"
304
305 // Signal sent when an overlay interface is shown, includes a gvariant
306-// gvariant format is (sb), (interface-name, can_maximize?)
307-#define UBUS_OVERLAY_FORMAT_STRING "(sbi)"
308+// gvariant format is (sb), (interface-name, can_maximize?, width, height)
309+#define UBUS_OVERLAY_FORMAT_STRING "(sbiii)"
310 #define UBUS_OVERLAY_HIDDEN "OVERLAY_HIDDEN"
311 #define UBUS_OVERLAY_SHOWN "OVERLAY_SHOWN"
312
313
314=== modified file 'unity-shared/WindowButtons.cpp'
315--- unity-shared/WindowButtons.cpp 2013-01-28 23:35:47 +0000
316+++ unity-shared/WindowButtons.cpp 2013-03-04 23:58:20 +0000
317@@ -429,8 +429,9 @@
318 glib::String overlay_identity;
319 gboolean can_maximise = FALSE;
320 gint32 overlay_monitor = 0;
321+ int width, height;
322 g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING,
323- &overlay_identity, &can_maximise, &overlay_monitor);
324+ &overlay_identity, &can_maximise, &overlay_monitor, &width, &height);
325
326 if (overlay_monitor != monitor())
327 {
328@@ -500,8 +501,9 @@
329 glib::String overlay_identity;
330 gboolean can_maximise = FALSE;
331 gint32 overlay_monitor = 0;
332+ int width, height;
333 g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING,
334- &overlay_identity, &can_maximise, &overlay_monitor);
335+ &overlay_identity, &can_maximise, &overlay_monitor, &width, &height);
336
337 if (overlay_monitor != monitor())
338 {