Merge lp:~azzar1/unity/fix-1308540 into lp:unity

Proposed by Andrea Azzarone
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: no longer in the source branch.
Merged at revision: 3863
Proposed branch: lp:~azzar1/unity/fix-1308540
Merge into: lp:unity
Diff against target: 347 lines (+83/-33)
8 files modified
lockscreen/LockScreenAbstractShield.h (+9/-1)
lockscreen/LockScreenController.cpp (+18/-1)
lockscreen/LockScreenController.h (+5/-0)
lockscreen/LockScreenShield.cpp (+17/-22)
lockscreen/LockScreenShield.h (+6/-3)
lockscreen/LockScreenShieldFactory.cpp (+7/-2)
lockscreen/LockScreenShieldFactory.h (+12/-2)
tests/test_lockscreen_controller.cpp (+9/-2)
To merge this branch: bzr merge lp:~azzar1/unity/fix-1308540
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+226455@code.launchpad.net

Commit message

Share lockscreen password entry between screens.

Description of the change

== Problem ==
[lockscreen] the password entry is not shared between screens

== Fix ==
Share the UserPromptView object between the shields.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:3791
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~andyrock/unity/fix-1308540/+merge/226455/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/unity-ci/1021/
Executed test runs:
    FAILURE: http://jenkins.qa.ubuntu.com/job/unity-utopic-amd64-ci/108/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/unity-utopic-armhf-ci/108/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/unity-utopic-i386-ci/108/console

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity-ci/1021/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Mostly looks fine, just check these two comments...

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:3839
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~andyrock/unity/fix-1308540/+merge/226455/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/unity-ci/1023/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-utopic-amd64-ci/110
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-utopic-armhf-ci/110
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-utopic-i386-ci/110

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity-ci/1023/rebuild

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

FAILED: Continuous integration, rev:3840
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~andyrock/unity/fix-1308540/+merge/226455/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/unity-ci/1024/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-utopic-amd64-ci/111
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-utopic-armhf-ci/111
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-utopic-i386-ci/111

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity-ci/1024/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

You also need http://pastebin.ubuntu.com/7833258/ not to fail the unityshell build, sad but true :/

Revision history for this message
Andrea Azzarone (azzar1) wrote :

> You also need http://pastebin.ubuntu.com/7833258/ not to fail the unityshell
> build, sad but true :/

Done!

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

+1

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

It seems there's a compile error here: http://pastebin.ubuntu.com/8144555/

review: Needs Fixing
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

(I guess there's another prompt_view_ defined as a simple pointer inside the actual Shield header)

Revision history for this message
Andrea Azzarone (azzar1) wrote :

Should work now!

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Yay

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lockscreen/LockScreenAbstractShield.h'
2--- lockscreen/LockScreenAbstractShield.h 2014-06-05 19:48:27 +0000
3+++ lockscreen/LockScreenAbstractShield.h 2014-08-27 13:25:30 +0000
4@@ -32,16 +32,23 @@
5 namespace lockscreen
6 {
7
8+class UserPromptView;
9+
10 class AbstractShield : public MockableBaseWindow
11 {
12 public:
13- AbstractShield(session::Manager::Ptr const& session, indicator::Indicators::Ptr const& indicators, Accelerators::Ptr const& accelerators, int monitor_num, bool is_primary)
14+ AbstractShield(session::Manager::Ptr const& session,
15+ indicator::Indicators::Ptr const& indicators,
16+ Accelerators::Ptr const& accelerators,
17+ nux::ObjectPtr<UserPromptView> const& prompt_view,
18+ int monitor_num, bool is_primary)
19 : MockableBaseWindow("Unity Lockscreen")
20 , primary(is_primary)
21 , monitor(monitor_num)
22 , session_manager_(session)
23 , indicators_(indicators)
24 , accelerators_(accelerators)
25+ , prompt_view_(prompt_view)
26 {}
27
28 nux::Property<bool> primary;
29@@ -58,6 +65,7 @@
30 session::Manager::Ptr session_manager_;
31 indicator::Indicators::Ptr indicators_;
32 Accelerators::Ptr accelerators_;
33+ nux::ObjectPtr<UserPromptView> prompt_view_;
34 };
35
36 } // lockscreen
37
38=== modified file 'lockscreen/LockScreenController.cpp'
39--- lockscreen/LockScreenController.cpp 2014-07-30 18:33:31 +0000
40+++ lockscreen/LockScreenController.cpp 2014-08-27 13:25:30 +0000
41@@ -24,6 +24,7 @@
42
43 #include "LockScreenShield.h"
44 #include "LockScreenSettings.h"
45+#include "UserPromptView.h"
46 #include "unity-shared/AnimationUtils.h"
47 #include "unity-shared/UScreen.h"
48 #include "unity-shared/WindowManager.h"
49@@ -154,6 +155,20 @@
50 primary_shield_->ActivatePanel();
51 }
52
53+UserPromptView* Controller::CreatePromptView()
54+{
55+ auto* prompt_view = new UserPromptView(session_manager_);
56+
57+ auto width = 8 * Settings::GRID_SIZE;
58+ auto height = 3 * Settings::GRID_SIZE;
59+
60+ prompt_view->SetMinimumWidth(width);
61+ prompt_view->SetMaximumWidth(width);
62+ prompt_view->SetMinimumHeight(height);
63+
64+ return prompt_view;
65+}
66+
67 void Controller::ResetPostLockScreenSaver()
68 {
69 screensaver_post_lock_timeout_.reset();
70@@ -192,6 +207,8 @@
71
72 shields_.resize(num_monitors);
73
74+ prompt_view_ = test_mode_ ? nullptr : CreatePromptView();
75+
76 for (int i = 0; i < num_monitors; ++i)
77 {
78 auto& shield = shields_[i];
79@@ -199,7 +216,7 @@
80
81 if (i >= shields_size)
82 {
83- shield = shield_factory_->CreateShield(session_manager_, indicators_, accelerator_controller_->GetAccelerators(), i, i == primary);
84+ shield = shield_factory_->CreateShield(session_manager_, indicators_, accelerator_controller_->GetAccelerators(), prompt_view_, i, i == primary);
85 is_new = true;
86 }
87
88
89=== modified file 'lockscreen/LockScreenController.h'
90--- lockscreen/LockScreenController.h 2014-05-20 11:49:40 +0000
91+++ lockscreen/LockScreenController.h 2014-08-27 13:25:30 +0000
92@@ -27,6 +27,7 @@
93 #include "LockScreenShieldFactory.h"
94 #include "LockScreenAcceleratorController.h"
95 #include "ScreenSaverDBusManager.h"
96+#include "UserPromptView.h"
97 #include "unity-shared/BackgroundEffectHelper.h"
98 #include "unity-shared/UpstartWrapper.h"
99
100@@ -35,6 +36,8 @@
101 namespace lockscreen
102 {
103
104+class UserPromptView;
105+
106 class Controller : public sigc::trackable
107 {
108 public:
109@@ -51,6 +54,7 @@
110 private:
111 friend class TestLockScreenController;
112
113+ UserPromptView* CreatePromptView();
114 void EnsureShields(std::vector<nux::Geometry> const& monitors);
115 void EnsureBlankWindow();
116 void LockScreen();
117@@ -79,6 +83,7 @@
118 AcceleratorController::Ptr accelerator_controller_;
119 UpstartWrapper::Ptr upstart_wrapper_;
120 ShieldFactoryInterface::Ptr shield_factory_;
121+ nux::ObjectPtr<UserPromptView> prompt_view_;
122
123 nux::animation::AnimateValue<double> fade_animator_;
124 nux::animation::AnimateValue<double> blank_window_animator_;
125
126=== modified file 'lockscreen/LockScreenShield.cpp'
127--- lockscreen/LockScreenShield.cpp 2014-07-30 20:10:23 +0000
128+++ lockscreen/LockScreenShield.cpp 2014-08-27 13:25:30 +0000
129@@ -42,10 +42,13 @@
130 const unsigned MAX_GRAB_WAIT = 50;
131 }
132
133-Shield::Shield(session::Manager::Ptr const& session_manager, indicator::Indicators::Ptr const& indicators, Accelerators::Ptr const& accelerators, int monitor_num, bool is_primary)
134- : AbstractShield(session_manager, indicators, accelerators, monitor_num, is_primary)
135+Shield::Shield(session::Manager::Ptr const& session_manager,
136+ indicator::Indicators::Ptr const& indicators,
137+ Accelerators::Ptr const& accelerators,
138+ nux::ObjectPtr<UserPromptView> const& prompt_view,
139+ int monitor_num, bool is_primary)
140+ : AbstractShield(session_manager, indicators, accelerators, prompt_view, monitor_num, is_primary)
141 , bg_settings_(std::make_shared<BackgroundSettings>())
142- , prompt_view_(nullptr)
143 , panel_view_(nullptr)
144 {
145 is_primary ? ShowPrimaryView() : ShowSecondaryView();
146@@ -117,6 +120,11 @@
147 if (primary_layout_)
148 {
149 GrabScreen(false);
150+
151+ if (prompt_view_ && prompt_view_->GetParentObject())
152+ static_cast<nux::Layout*>(prompt_view_->GetParentObject())->RemoveChildObject(prompt_view_.GetPointer());
153+ prompt_layout_->AddView(prompt_view_.GetPointer());
154+
155 SetLayout(primary_layout_.GetPointer());
156 return;
157 }
158@@ -128,15 +136,16 @@
159
160 main_layout->AddView(CreatePanel());
161
162- nux::HLayout* prompt_layout = new nux::HLayout();
163- prompt_layout->SetLeftAndRightPadding(2 * Settings::GRID_SIZE);
164+ prompt_layout_ = new nux::HLayout();
165+ prompt_layout_->SetLeftAndRightPadding(2 * Settings::GRID_SIZE);
166
167- prompt_view_ = CreatePromptView();
168- prompt_layout->AddView(prompt_view_);
169+ if (prompt_view_ && prompt_view_->GetParentObject())
170+ static_cast<nux::Layout*>(prompt_view_->GetParentObject())->RemoveChildObject(prompt_view_.GetPointer());
171+ prompt_layout_->AddView(prompt_view_.GetPointer());
172
173 // 10 is just a random number to center the prompt view.
174 main_layout->AddSpace(0, 10);
175- main_layout->AddLayout(prompt_layout);
176+ main_layout->AddLayout(prompt_layout_.GetPointer());
177 main_layout->AddSpace(0, 10);
178 }
179
180@@ -182,20 +191,6 @@
181 return panel_view_;
182 }
183
184-UserPromptView* Shield::CreatePromptView()
185-{
186- auto* prompt_view = new UserPromptView(session_manager_);
187-
188- auto width = 8 * Settings::GRID_SIZE;
189- auto height = 3 * Settings::GRID_SIZE;
190-
191- prompt_view->SetMinimumWidth(width);
192- prompt_view->SetMaximumWidth(width);
193- prompt_view->SetMinimumHeight(height);
194-
195- return prompt_view;
196-}
197-
198 nux::Area* Shield::FindKeyFocusArea(unsigned etype, unsigned long keysym, unsigned long modifiers)
199 {
200 if (primary)
201
202=== modified file 'lockscreen/LockScreenShield.h'
203--- lockscreen/LockScreenShield.h 2014-07-30 18:33:31 +0000
204+++ lockscreen/LockScreenShield.h 2014-08-27 13:25:30 +0000
205@@ -37,7 +37,11 @@
206 class Shield : public AbstractShield
207 {
208 public:
209- Shield(session::Manager::Ptr const&, indicator::Indicators::Ptr const&, Accelerators::Ptr const&, int monitor, bool is_primary);
210+ Shield(session::Manager::Ptr const&,
211+ indicator::Indicators::Ptr const&,
212+ Accelerators::Ptr const&,
213+ nux::ObjectPtr<UserPromptView> const&,
214+ int monitor, bool is_primary);
215
216 bool IsIndicatorOpen() const override;
217 void ActivatePanel() override;
218@@ -53,16 +57,15 @@
219 void ShowPrimaryView();
220 void ShowSecondaryView();
221 Panel* CreatePanel();
222- UserPromptView* CreatePromptView();
223
224 std::shared_ptr<BackgroundSettings> bg_settings_;
225 std::unique_ptr<nux::AbstractPaintLayer> background_layer_;
226 nux::ObjectPtr<nux::Layout> primary_layout_;
227+ nux::ObjectPtr<nux::Layout> prompt_layout_;
228 nux::ObjectPtr<nux::Layout> cof_layout_;
229 connection::Wrapper panel_active_conn_;
230 connection::Wrapper regrab_conn_;
231 glib::Source::UniquePtr regrab_timeout_;
232- UserPromptView* prompt_view_;
233 Panel* panel_view_;
234 };
235
236
237=== modified file 'lockscreen/LockScreenShieldFactory.cpp'
238--- lockscreen/LockScreenShieldFactory.cpp 2014-04-17 13:08:05 +0000
239+++ lockscreen/LockScreenShieldFactory.cpp 2014-08-27 13:25:30 +0000
240@@ -19,15 +19,20 @@
241
242 #include "LockScreenShieldFactory.h"
243 #include "LockScreenShield.h"
244+#include "UserPromptView.h"
245
246 namespace unity
247 {
248 namespace lockscreen
249 {
250
251-nux::ObjectPtr<AbstractShield> ShieldFactory::CreateShield(session::Manager::Ptr const& session_manager, indicator::Indicators::Ptr const& indicators, Accelerators::Ptr const& accelerators, int monitor, bool is_primary)
252+nux::ObjectPtr<AbstractShield> ShieldFactory::CreateShield(session::Manager::Ptr const& session_manager,
253+ indicator::Indicators::Ptr const& indicators,
254+ Accelerators::Ptr const& accelerators,
255+ nux::ObjectPtr<UserPromptView> const& prompt_view,
256+ int monitor, bool is_primary)
257 {
258- return nux::ObjectPtr<Shield>(new Shield(session_manager, indicators, accelerators, monitor, is_primary));
259+ return nux::ObjectPtr<Shield>(new Shield(session_manager, indicators, accelerators, prompt_view, monitor, is_primary));
260 }
261
262 }
263
264=== modified file 'lockscreen/LockScreenShieldFactory.h'
265--- lockscreen/LockScreenShieldFactory.h 2014-04-17 13:08:05 +0000
266+++ lockscreen/LockScreenShieldFactory.h 2014-08-27 13:25:30 +0000
267@@ -31,18 +31,28 @@
268 namespace lockscreen
269 {
270
271+class UserPromptView;
272+
273 struct ShieldFactoryInterface
274 {
275 typedef std::shared_ptr<ShieldFactoryInterface> Ptr;
276
277 virtual ~ShieldFactoryInterface() = default;
278
279- virtual nux::ObjectPtr<AbstractShield> CreateShield(session::Manager::Ptr const&, indicator::Indicators::Ptr const&, Accelerators::Ptr const&, int monitor, bool is_primary) = 0;
280+ virtual nux::ObjectPtr<AbstractShield> CreateShield(session::Manager::Ptr const&,
281+ indicator::Indicators::Ptr const&,
282+ Accelerators::Ptr const&,
283+ nux::ObjectPtr<UserPromptView> const&,
284+ int monitor, bool is_primary) = 0;
285 };
286
287 struct ShieldFactory : ShieldFactoryInterface
288 {
289- nux::ObjectPtr<AbstractShield> CreateShield(session::Manager::Ptr const&, indicator::Indicators::Ptr const&, Accelerators::Ptr const&, int monitor, bool is_primary) override;
290+ nux::ObjectPtr<AbstractShield> CreateShield(session::Manager::Ptr const&,
291+ indicator::Indicators::Ptr const&,
292+ Accelerators::Ptr const&,
293+ nux::ObjectPtr<UserPromptView> const&,
294+ int monitor, bool is_primary) override;
295 };
296
297 }
298
299=== modified file 'tests/test_lockscreen_controller.cpp'
300--- tests/test_lockscreen_controller.cpp 2014-06-07 16:26:59 +0000
301+++ tests/test_lockscreen_controller.cpp 2014-08-27 13:25:30 +0000
302@@ -20,6 +20,7 @@
303 #include <gmock/gmock.h>
304 using namespace testing;
305
306+#include "lockscreen/UserPromptView.h"
307 #include "lockscreen/LockScreenController.h"
308
309 #include <Nux/NuxTimerTickSource.h>
310@@ -29,6 +30,7 @@
311
312 #include "lockscreen/LockScreenSettings.h"
313 #include "lockscreen/ScreenSaverDBusManager.h"
314+#include "unity-shared/DashStyle.h"
315 #include "unity-shared/PanelStyle.h"
316 #include "unity-shared/UScreen.h"
317 #include "test_mock_session_manager.h"
318@@ -52,7 +54,7 @@
319 struct MockShield : AbstractShield
320 {
321 MockShield()
322- : AbstractShield(nullptr, nullptr, nullptr, 0, false)
323+ : AbstractShield(nullptr, nullptr, nullptr, nux::ObjectPtr<UserPromptView>(), 0, false)
324 {}
325
326 MOCK_CONST_METHOD0(IsIndicatorOpen, bool());
327@@ -61,7 +63,11 @@
328
329 struct ShieldFactoryMock : ShieldFactoryInterface
330 {
331- nux::ObjectPtr<AbstractShield> CreateShield(session::Manager::Ptr const&, indicator::Indicators::Ptr const&, Accelerators::Ptr const&, int, bool) override
332+ nux::ObjectPtr<AbstractShield> CreateShield(session::Manager::Ptr const&,
333+ indicator::Indicators::Ptr const&,
334+ Accelerators::Ptr const&,
335+ nux::ObjectPtr<UserPromptView> const&,
336+ int, bool) override
337 {
338 return nux::ObjectPtr<AbstractShield>(new MockShield());
339 }
340@@ -95,6 +101,7 @@
341 nux::animation::AnimationController animation_controller;
342
343 MockUScreen uscreen;
344+ unity::dash::Style dash_style;
345 unity::panel::Style panel_style;
346 unity::lockscreen::Settings lockscreen_settings;
347 session::MockManager::Ptr session_manager;