Merge lp:~gerboland/unity-mir/ownership-to-mir into lp:unity-mir
- ownership-to-mir
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Albert Astals Cid |
Approved revision: | 56 |
Merged at revision: | 58 |
Proposed branch: | lp:~gerboland/unity-mir/ownership-to-mir |
Merge into: | lp:unity-mir |
Diff against target: |
369 lines (+97/-95) 7 files modified
src/modules/Unity/ApplicationManager/application_manager.cpp (+1/-5) src/unity-mir/logging.h (+2/-0) src/unity-mir/shellserverconfiguration.cpp (+59/-41) src/unity-mir/shellserverconfiguration.h (+7/-10) src/unity-mir/surfacecontroller.cpp (+18/-24) src/unity-mir/surfacecontroller.h (+7/-12) src/unity-mir/unity-mir.pro (+3/-3) |
To merge this branch: | bzr merge lp:~gerboland/unity-mir/ownership-to-mir |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Albert Astals Cid (community) | Approve | ||
Review via email:
|
Commit message
Do not directly instantiate objects, instead let Mir do it. Fixes issues with Mir since revno 982. Also rename SessionBuilder to SessionController.
Description of the change
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:56
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Albert Astals Cid (aacid) wrote : | # |
Looks reasonable, and actually makes things work again, so approve :-)
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
Approved revid is not set in launchpad. This is most likely a launchpad issue and re-approve should fix it. There is also a chance (although a very small one) this is a permission problem of the ps-jenkins bot.
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Gerry Boland (gerboland) wrote : | # |
Reapproving
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
FAILURE: http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) : | # |
Preview Diff
1 | === modified file 'src/modules/Unity/ApplicationManager/application_manager.cpp' |
2 | --- src/modules/Unity/ApplicationManager/application_manager.cpp 2013-08-21 14:58:52 +0000 |
3 | +++ src/modules/Unity/ApplicationManager/application_manager.cpp 2013-08-22 12:07:06 +0000 |
4 | @@ -68,11 +68,7 @@ |
5 | this, &ApplicationManager::sessionUnfocused); |
6 | QObject::connect(m_mirServer->sessionListener(), &SessionListener::sessionCreatedSurface, |
7 | this, &ApplicationManager::sessionCreatedSurface); |
8 | - |
9 | - std::shared_ptr<SessionAuthorizer> sessionAuthorizer |
10 | - = std::dynamic_pointer_cast<SessionAuthorizer>(m_mirServer->the_session_authorizer()); |
11 | - |
12 | - QObject::connect(sessionAuthorizer.get(), &SessionAuthorizer::requestAuthorizationForSession, |
13 | + QObject::connect(m_mirServer->sessionAuthorizer(), &SessionAuthorizer::requestAuthorizationForSession, |
14 | this, &ApplicationManager::authorizedSession, Qt::BlockingQueuedConnection); |
15 | |
16 | // we use random numbers, so seed the generator |
17 | |
18 | === modified file 'src/unity-mir/logging.h' |
19 | --- src/unity-mir/logging.h 2013-08-09 13:16:13 +0000 |
20 | +++ src/unity-mir/logging.h 2013-08-22 12:07:06 +0000 |
21 | @@ -17,6 +17,8 @@ |
22 | #ifndef UBUNTU_APPLICATION_PLUGIN_LOGGING_H |
23 | #define UBUNTU_APPLICATION_PLUGIN_LOGGING_H |
24 | |
25 | +#include <QDebug> |
26 | + |
27 | // Logging and assertion macros. |
28 | #define LOG(...) qDebug(__VA_ARGS__) |
29 | #define LOG_IF(cond,...) do { if (cond) qDebug(__VA_ARGS__); } while(0) |
30 | |
31 | === modified file 'src/unity-mir/shellserverconfiguration.cpp' |
32 | --- src/unity-mir/shellserverconfiguration.cpp 2013-08-20 11:24:34 +0000 |
33 | +++ src/unity-mir/shellserverconfiguration.cpp 2013-08-22 12:07:06 +0000 |
34 | @@ -21,26 +21,20 @@ |
35 | #include "surfaceconfigurator.h" |
36 | #include "surfacesource.h" |
37 | #include "sessionauthorizer.h" |
38 | -#include "surfacebuilder.h" |
39 | +#include "surfacecontroller.h" |
40 | +#include "logging.h" |
41 | |
42 | // mir |
43 | #include "mir/shell/organising_surface_factory.h" |
44 | |
45 | -// Qt |
46 | -#include <QDebug> |
47 | - |
48 | namespace msh = mir::shell; |
49 | +namespace ms = mir::surfaces; |
50 | |
51 | ShellServerConfiguration::ShellServerConfiguration(int argc, char const* argv[], QObject* parent) |
52 | : QObject(parent) |
53 | , DefaultServerConfiguration(argc, argv) |
54 | - , m_surfaceBuilder(new SurfaceBuilder(the_surface_stack_model())) |
55 | - , m_surfaceConfigurator(new SurfaceConfigurator) |
56 | - , m_sessionListener(new SessionListener) |
57 | - , m_surfaceSource(new SurfaceSource(the_surface_builder(), the_shell_surface_configurator())) |
58 | - , m_sessionAuthorizer(new SessionAuthorizer(the_session_manager())) |
59 | { |
60 | - qDebug() << "ShellServerConfiguration created"; |
61 | + DLOG("ShellServerConfiguration created"); |
62 | } |
63 | |
64 | ShellServerConfiguration::~ShellServerConfiguration() |
65 | @@ -60,55 +54,79 @@ |
66 | std::shared_ptr<msh::SessionListener> |
67 | ShellServerConfiguration::the_shell_session_listener() |
68 | { |
69 | - std::shared_ptr<SessionListener> sessionListener = m_sessionListener; |
70 | return shell_session_listener( |
71 | - [this, &sessionListener] |
72 | + [this] |
73 | { |
74 | - return sessionListener; |
75 | + return std::make_shared<SessionListener>(); |
76 | }); |
77 | } |
78 | |
79 | std::shared_ptr<msh::SurfaceConfigurator> |
80 | ShellServerConfiguration::the_shell_surface_configurator() |
81 | { |
82 | - return m_surfaceConfigurator; |
83 | -} |
84 | - |
85 | + return shell_surface_configurator( |
86 | + [this]() |
87 | + { |
88 | + return std::make_shared<SurfaceConfigurator>(); |
89 | + }); |
90 | +} |
91 | + |
92 | +std::shared_ptr<ms::SurfaceController> |
93 | +ShellServerConfiguration::the_surface_controller() |
94 | +{ |
95 | + return surface_controller( |
96 | + [this]() |
97 | + { |
98 | + return std::make_shared<SurfaceController>(the_surface_stack_model()); |
99 | + }); |
100 | +} |
101 | + |
102 | +std::shared_ptr<mir::frontend::SessionAuthorizer> |
103 | +ShellServerConfiguration::the_session_authorizer() |
104 | +{ |
105 | + return session_authorizer( |
106 | + [this]() |
107 | + { |
108 | + return std::make_shared<SessionAuthorizer>(the_session_manager()); |
109 | + }); |
110 | +} |
111 | + |
112 | +// FIXME: Needed to detect the shell's surface - there must be a better way |
113 | std::shared_ptr<msh::SurfaceFactory> |
114 | ShellServerConfiguration::the_shell_surface_factory() |
115 | { |
116 | return shell_surface_factory( |
117 | - [this] |
118 | + [this]() |
119 | { |
120 | - return std::make_shared<mir::shell::OrganisingSurfaceFactory>( |
121 | + m_surfaceSource = std::make_shared<SurfaceSource>( |
122 | + the_surface_builder(), the_shell_surface_configurator()); |
123 | + |
124 | + return std::make_shared<msh::OrganisingSurfaceFactory>( |
125 | m_surfaceSource, |
126 | the_shell_placement_strategy()); |
127 | }); |
128 | } |
129 | |
130 | -std::shared_ptr<msh::SurfaceBuilder> |
131 | -ShellServerConfiguration::the_surface_builder() |
132 | -{ |
133 | - return m_surfaceBuilder; |
134 | -} |
135 | - |
136 | -std::shared_ptr<mir::frontend::SessionAuthorizer> |
137 | -ShellServerConfiguration::the_session_authorizer() |
138 | -{ |
139 | - return m_sessionAuthorizer; |
140 | -} |
141 | - |
142 | -SurfaceConfigurator *ShellServerConfiguration::surfaceConfigurator() const |
143 | -{ |
144 | - return m_surfaceConfigurator.get(); |
145 | -} |
146 | - |
147 | -SessionListener *ShellServerConfiguration::sessionListener() const |
148 | -{ |
149 | - return m_sessionListener.get(); |
150 | -} |
151 | - |
152 | -SurfaceSource *ShellServerConfiguration::surfaceSource() const |
153 | +/************************************ Shell side ************************************/ |
154 | +SessionAuthorizer *ShellServerConfiguration::sessionAuthorizer() |
155 | +{ |
156 | + SessionAuthorizer *ptr = static_cast<SessionAuthorizer*>(the_session_authorizer().get()); |
157 | + return q_check_ptr(ptr); //CHECKME will this always be ready before shell comes up? |
158 | +} |
159 | + |
160 | +SessionListener *ShellServerConfiguration::sessionListener() |
161 | +{ |
162 | + SessionListener *ptr = static_cast<SessionListener*>(the_shell_session_listener().get()); |
163 | + return q_check_ptr(ptr); //CHECKME will this always be ready before shell comes up? |
164 | +} |
165 | + |
166 | +SurfaceConfigurator *ShellServerConfiguration::surfaceConfigurator() |
167 | +{ |
168 | + SurfaceConfigurator *ptr = static_cast<SurfaceConfigurator*>(the_shell_surface_configurator().get()); |
169 | + return q_check_ptr(ptr); //CHECKME will this always be ready before shell comes up? |
170 | +} |
171 | + |
172 | +SurfaceSource *ShellServerConfiguration::surfaceSource() |
173 | { |
174 | return m_surfaceSource.get(); |
175 | } |
176 | |
177 | === modified file 'src/unity-mir/shellserverconfiguration.h' |
178 | --- src/unity-mir/shellserverconfiguration.h 2013-08-16 16:07:50 +0000 |
179 | +++ src/unity-mir/shellserverconfiguration.h 2013-08-22 12:07:06 +0000 |
180 | @@ -23,15 +23,15 @@ |
181 | class SessionListener; |
182 | class SessionAuthorizer; |
183 | class SurfaceSource; |
184 | -class SurfaceBuilder; |
185 | class SurfaceConfigurator; |
186 | |
187 | class ShellServerConfiguration : public QObject, public mir::DefaultServerConfiguration |
188 | { |
189 | Q_OBJECT |
190 | |
191 | + Q_PROPERTY(SessionAuthorizer* sessionAuthorizer READ sessionAuthorizer CONSTANT) |
192 | + Q_PROPERTY(SessionListener* sessionListener READ sessionListener CONSTANT) |
193 | Q_PROPERTY(SurfaceConfigurator* surfaceConfigurator READ surfaceConfigurator CONSTANT) |
194 | - Q_PROPERTY(SessionListener* sessionListener READ sessionListener CONSTANT) |
195 | Q_PROPERTY(SurfaceSource* surfaceSource READ surfaceSource CONSTANT) |
196 | |
197 | public: |
198 | @@ -44,20 +44,17 @@ |
199 | std::shared_ptr<mir::shell::SurfaceConfigurator> the_shell_surface_configurator() override; |
200 | std::shared_ptr<mir::shell::SurfaceFactory> the_shell_surface_factory() override; |
201 | std::shared_ptr<mir::frontend::SessionAuthorizer> the_session_authorizer() override; |
202 | - std::shared_ptr<mir::shell::SurfaceBuilder> the_surface_builder() override; |
203 | + std::shared_ptr<mir::surfaces::SurfaceController> the_surface_controller() override; |
204 | |
205 | /* qt specific */ |
206 | // getters |
207 | - SurfaceConfigurator *surfaceConfigurator() const; |
208 | - SessionListener *sessionListener() const; |
209 | - SurfaceSource *surfaceSource() const; |
210 | + SessionAuthorizer *sessionAuthorizer(); |
211 | + SessionListener *sessionListener(); |
212 | + SurfaceConfigurator *surfaceConfigurator(); |
213 | + SurfaceSource *surfaceSource(); |
214 | |
215 | protected: |
216 | - std::shared_ptr<SurfaceBuilder> m_surfaceBuilder; |
217 | - std::shared_ptr<SurfaceConfigurator> m_surfaceConfigurator; |
218 | - std::shared_ptr<SessionListener> m_sessionListener; |
219 | std::shared_ptr<SurfaceSource> m_surfaceSource; |
220 | - std::shared_ptr<SessionAuthorizer> m_sessionAuthorizer; |
221 | }; |
222 | |
223 | #endif // SHELLSERVERCONFIGURATION_H |
224 | |
225 | === renamed file 'src/unity-mir/surfacebuilder.cpp' => 'src/unity-mir/surfacecontroller.cpp' |
226 | --- src/unity-mir/surfacebuilder.cpp 2013-08-20 12:31:11 +0000 |
227 | +++ src/unity-mir/surfacecontroller.cpp 2013-08-22 12:07:06 +0000 |
228 | @@ -17,28 +17,28 @@ |
229 | #include <mir/surfaces/surface_stack_model.h> |
230 | #include <mir/shell/surface_creation_parameters.h> // TODO: Remove ~racarr |
231 | |
232 | -#include "surfacebuilder.h" |
233 | +#include "surfacecontroller.h" |
234 | |
235 | #include "logging.h" |
236 | |
237 | namespace msh = mir::shell; |
238 | namespace ms = mir::surfaces; |
239 | |
240 | -SurfaceBuilder::SurfaceBuilder(const std::shared_ptr<ms::SurfaceStackModel>& surfaceStack, QObject *parent) : |
241 | +SurfaceController::SurfaceController(const std::shared_ptr<ms::SurfaceStackModel>& surfaceStack, QObject *parent) : |
242 | QObject(parent), |
243 | - m_surfaceStack(surfaceStack) |
244 | -{ |
245 | - DLOG("SurfaceBuilder::SurfaceBuilder (this=%p)", this); |
246 | -} |
247 | - |
248 | -SurfaceBuilder::~SurfaceBuilder() |
249 | -{ |
250 | - DLOG("SurfaceBuilder::~SurfaceBuilder (this=%p)", this); |
251 | -} |
252 | - |
253 | -std::weak_ptr<ms::Surface> SurfaceBuilder::create_surface(mir::shell::Session *session, const msh::SurfaceCreationParameters& params) |
254 | -{ |
255 | - DLOG("SurfaceBuilder::~create_surface (this=%p)", this); |
256 | + ms::SurfaceController(surfaceStack) |
257 | +{ |
258 | + DLOG("SurfaceController::SurfaceController (this=%p)", this); |
259 | +} |
260 | + |
261 | +SurfaceController::~SurfaceController() |
262 | +{ |
263 | + DLOG("SurfaceController::~SurfaceController (this=%p)", this); |
264 | +} |
265 | + |
266 | +std::weak_ptr<ms::Surface> SurfaceController::create_surface(msh::Session *session, const msh::SurfaceCreationParameters& params) |
267 | +{ |
268 | + DLOG("SurfaceController::~create_surface (this=%p)", this); |
269 | Q_UNUSED(session) |
270 | |
271 | static const ms::DepthId shellSurfaceDepth{1}; |
272 | @@ -50,21 +50,15 @@ |
273 | auto newParams = params; |
274 | newParams.depth = shellSurfaceDepth; |
275 | shellSurfaceFound = true; |
276 | - return m_surfaceStack->create_surface(newParams); |
277 | + return surface_stack->create_surface(newParams); |
278 | } else if (params.name == "MaliitOnScreenKeyboard") { // FIXME: string hardcoded into maliit |
279 | DLOG("OSK depth"); |
280 | auto newParams = params; |
281 | newParams.depth = oskSurfaceDepth; |
282 | - return m_surfaceStack->create_surface(newParams); |
283 | + return surface_stack->create_surface(newParams); |
284 | } else { |
285 | DLOG("Default depth"); |
286 | - return m_surfaceStack->create_surface(params); |
287 | + return surface_stack->create_surface(params); |
288 | } |
289 | } |
290 | |
291 | -void SurfaceBuilder::destroy_surface(const std::weak_ptr<ms::Surface>& surface) |
292 | -{ |
293 | - DLOG("SurfaceBuilder::~destroy_surface (this=%p)", this); |
294 | - |
295 | - m_surfaceStack->destroy_surface(surface); |
296 | -} |
297 | |
298 | === renamed file 'src/unity-mir/surfacebuilder.h' => 'src/unity-mir/surfacecontroller.h' |
299 | --- src/unity-mir/surfacebuilder.h 2013-08-12 11:12:48 +0000 |
300 | +++ src/unity-mir/surfacecontroller.h 2013-08-22 12:07:06 +0000 |
301 | @@ -14,31 +14,26 @@ |
302 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
303 | */ |
304 | |
305 | -#ifndef SURFACEBUILDER_H |
306 | -#define SURFACEBUILDER_H |
307 | +#ifndef SURFACECONTROLLER_H |
308 | +#define SURFACECONTROLLER_H |
309 | |
310 | #include <QObject> |
311 | |
312 | -#include "mir/shell/surface_builder.h" |
313 | +#include "mir/surfaces/surface_controller.h" |
314 | |
315 | namespace mir { namespace surfaces { class SurfaceStackModel; }} |
316 | |
317 | -class SurfaceBuilder : public QObject, public mir::shell::SurfaceBuilder |
318 | +class SurfaceController : public QObject, public mir::surfaces::SurfaceController |
319 | { |
320 | Q_OBJECT |
321 | |
322 | public: |
323 | - explicit SurfaceBuilder(const std::shared_ptr<mir::surfaces::SurfaceStackModel>& surfaceStack, QObject *parent = 0); |
324 | - ~SurfaceBuilder(); |
325 | + explicit SurfaceController(const std::shared_ptr<mir::surfaces::SurfaceStackModel>& surfaceStack, QObject *parent = 0); |
326 | + ~SurfaceController(); |
327 | |
328 | virtual std::weak_ptr<mir::surfaces::Surface> create_surface( |
329 | mir::shell::Session* session, |
330 | const mir::shell::SurfaceCreationParameters ¶ms) override; |
331 | - |
332 | - virtual void destroy_surface(const std::weak_ptr<mir::surfaces::Surface>& surface) override; |
333 | - |
334 | -private: |
335 | - const std::shared_ptr<mir::surfaces::SurfaceStackModel> m_surfaceStack; |
336 | }; |
337 | |
338 | -#endif // SURFACEBUILDER_H |
339 | +#endif // SURFACECONTROLLER_H |
340 | |
341 | === modified file 'src/unity-mir/unity-mir.pro' |
342 | --- src/unity-mir/unity-mir.pro 2013-08-21 09:36:24 +0000 |
343 | +++ src/unity-mir/unity-mir.pro 2013-08-22 12:07:06 +0000 |
344 | @@ -19,7 +19,7 @@ |
345 | sessionauthorizer.cpp \ |
346 | sessionlistener.cpp \ |
347 | shellserverconfiguration.cpp \ |
348 | - surfacebuilder.cpp \ |
349 | + surfacecontroller.cpp \ |
350 | surfacesource.cpp \ |
351 | surfaceconfigurator.cpp |
352 | |
353 | @@ -29,7 +29,7 @@ |
354 | sessionauthorizer.h \ |
355 | sessionlistener.h \ |
356 | shellserverconfiguration.h \ |
357 | - surfacebuilder.h \ |
358 | + surfacecontroller.h \ |
359 | surfacesource.h \ |
360 | surfaceconfigurator.h \ |
361 | logging.h |
362 | @@ -42,7 +42,7 @@ |
363 | sessionauthorizer.h \ |
364 | sessionlistener.h \ |
365 | shellserverconfiguration.h \ |
366 | - surfacebuilder.h \ |
367 | + surfacecontroller.h \ |
368 | surfacesource.h |
369 | install_headers.path = /usr/include/unity-mir |
370 |
PASSED: Continuous integration, rev:55 jenkins. qa.ubuntu. com/job/ unity-mir- ci/41/ jenkins. qa.ubuntu. com/job/ unity-mir- saucy-armhf- ci/41 jenkins. qa.ubuntu. com/job/ unity-mir- saucy-armhf- ci/41/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ unity-mir- saucy-i386- ci/41
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins: 8080/job/ unity-mir- ci/41/rebuild
http://