Merge lp:~alan-griffiths/mir/MVC-rework-WindowManager-examples-using-msh-Shell into lp:mir
- MVC-rework-WindowManager-examples-using-msh-Shell
- Merge into development-branch
Status: | Merged |
---|---|
Approved by: | Alan Griffiths |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2294 |
Proposed branch: | lp:~alan-griffiths/mir/MVC-rework-WindowManager-examples-using-msh-Shell |
Merge into: | lp:mir |
Prerequisite: | lp:~alan-griffiths/mir/MVC-refactor-msh-Shell-hierarchy |
Diff against target: |
671 lines (+202/-268) 3 files modified
examples/server_example_window_management.cpp (+192/-181) examples/server_example_window_management.h (+2/-21) examples/server_example_window_manager.cpp (+8/-66) |
To merge this branch: | bzr merge lp:~alan-griffiths/mir/MVC-rework-WindowManager-examples-using-msh-Shell |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Alberto Aguirre (community) | Approve | ||
Alexandros Frantzis (community) | Approve | ||
Review via email: mp+248138@code.launchpad.net |
Commit message
examples: rework WindowManager examples using msh::Shell
Description of the change
examples: rework WindowManager examples using msh::Shell
PS Jenkins bot (ps-jenkins) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2289
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2291
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2292
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Alexandros Frantzis (afrantzis) wrote : | # |
Looks good (and works).
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Alan Griffiths (alan-griffiths) wrote : | # |
unrelated (but wrong anyway)...
4: [ RUN ] SurfaceSwapBuff
4: [1423046327.627221] Loader: Loading modules from: /tmp/buildd/
4: [1423046327.665939] Loader: Loading module: /tmp/buildd/
4: [1423046327.666288] Loader: Loading module: /tmp/buildd/
4: [1423046327.666614] Loader: Loading module: /tmp/buildd/
4: /tmp/buildd/
4: Value of: buffers_
4: Actual: false
4: Expected: true
4: ==26557== Thread 9:
4: ==26557== Conditional jump or move depends on uninitialised value(s)
4: ==26557== at 0x5C8C88F: __lll_lock_elision (elision-lock.c:94)
4: ==26557== by 0x7282F7: __gthread_
4: ==26557== by 0x7282F7: lock (mutex:135)
4: ==26557== by 0x7282F7: lock (mutex:474)
4: ==26557== by 0x7282F7: unique_lock (mutex:406)
4: ==26557== by 0x7282F7: mir::test:
4: ==26557== by 0x5281DAC: operator() (functional:2439)
4: ==26557== by 0x5281DAC: mir::client:
4: ==26557== by 0x52839FE: google:
4: ==26557== by 0x5297B4C: mir::client:
4: ==26557== by 0x52991FE: google:
4: ==26557== by 0x5296AAF: mir::client:
4: ==26557== by 0x5299008: mir::client:
4: ==26557== by 0x52900C0: mir::client:
4: ==26557== by 0x52904E2: mir::client:
4: ==26557== by 0x6539D25: wait_for_
4: ==26557== by 0x6539D25: operator() (simple_
4: ==26557== by 0x6539D25: _M_invoke<> (functional:1700)
4: ==26557== by 0x6539D25: operator() (functional:1688)
4: ==26557== by 0x6539D25: std::thread:
4: ==26557== by 0x6A31E2F: ??? (in /usr/lib/
4: =...
PS Jenkins bot (ps-jenkins) : | # |
Preview Diff
1 | === modified file 'examples/server_example_window_management.cpp' |
2 | --- examples/server_example_window_management.cpp 2015-02-03 10:48:32 +0000 |
3 | +++ examples/server_example_window_management.cpp 2015-02-03 10:48:32 +0000 |
4 | @@ -27,8 +27,10 @@ |
5 | #include "mir/geometry/displacement.h" |
6 | #include "mir/input/composite_event_filter.h" |
7 | #include "mir/options/option.h" |
8 | -#include "mir/scene/session_listener.h" |
9 | -#include "mir/shell/focus_controller.h" |
10 | +#include "mir/scene/session.h" |
11 | +#include "mir/scene/surface.h" |
12 | +#include "mir/scene/surface_creation_parameters.h" |
13 | +#include "mir/shell/abstract_shell.h" |
14 | |
15 | #include <linux/input.h> |
16 | |
17 | @@ -38,6 +40,7 @@ |
18 | |
19 | namespace mc = mir::compositor; |
20 | namespace me = mir::examples; |
21 | +namespace mf = mir::frontend; |
22 | namespace mg = mir::graphics; |
23 | namespace mi = mir::input; |
24 | namespace ms = mir::scene; |
25 | @@ -56,19 +59,28 @@ |
26 | char const* const wm_fullscreen = "fullscreen"; |
27 | |
28 | // Very simple - make every surface fullscreen |
29 | -class FullscreenWindowManager : public me::WindowManager, me::FullscreenPlacementStrategy |
30 | +class FullscreenWindowManager : public me::WindowManager, |
31 | + msh::AbstractShell, |
32 | + me::FullscreenPlacementStrategy |
33 | { |
34 | public: |
35 | - using me::FullscreenPlacementStrategy::FullscreenPlacementStrategy; |
36 | + FullscreenWindowManager( |
37 | + std::shared_ptr<msh::InputTargeter> const& input_targeter, |
38 | + std::shared_ptr<ms::SurfaceCoordinator> const& surface_coordinator, |
39 | + std::shared_ptr<ms::SessionCoordinator> const& session_coordinator, |
40 | + std::shared_ptr<ms::PromptSessionManager> const& prompt_session_manager, |
41 | + std::shared_ptr<msh::DisplayLayout> const& display_layout) : |
42 | + AbstractShell(input_targeter, surface_coordinator, session_coordinator, prompt_session_manager), |
43 | + FullscreenPlacementStrategy{display_layout} |
44 | + { |
45 | + } |
46 | |
47 | private: |
48 | - void add_surface(std::shared_ptr<ms::Surface> const&, ms::Session*) override {} |
49 | - |
50 | - void remove_surface(std::weak_ptr<ms::Surface> const&, ms::Session*) override {} |
51 | - |
52 | - void add_session(std::shared_ptr<ms::Session> const&) override {} |
53 | - |
54 | - void remove_session(std::shared_ptr<ms::Session> const&) override {} |
55 | + mf::SurfaceId create_surface(std::shared_ptr<ms::Session> const& session, ms::SurfaceCreationParameters const& params) override |
56 | + { |
57 | + ms::SurfaceCreationParameters const placed_params = place(*session, params); |
58 | + return msh::AbstractShell::create_surface(session, placed_params); |
59 | + } |
60 | |
61 | void add_display(Rectangle const&) override {} |
62 | |
63 | @@ -81,11 +93,6 @@ |
64 | void resize(Point) override {} |
65 | |
66 | void toggle(MirSurfaceState) override {} |
67 | - |
68 | - int select_attribute_value(ms::Surface const&, MirSurfaceAttrib, int requested_value) override |
69 | - { return requested_value; } |
70 | - |
71 | - void attribute_set(ms::Surface const&, MirSurfaceAttrib, int) override {} |
72 | }; |
73 | |
74 | // simple tiling algorithm: |
75 | @@ -96,79 +103,13 @@ |
76 | // o Maximize/restore current window (to tile height): Shift-F11 |
77 | // o Maximize/restore current window (to tile width): Ctrl-F11 |
78 | // o client requests to maximize, vertically maximize & restore |
79 | -class TilingWindowManager : public me::WindowManager |
80 | +class TilingWindowManager : public me::WindowManager, |
81 | + msh::AbstractShell |
82 | { |
83 | public: |
84 | - // We can't take the msh::FocusController directly as we create a WindowManager |
85 | - // in the_session_listener() and that is called when creating the focus controller |
86 | - using FocusControllerFactory = std::function<std::shared_ptr<msh::FocusController>()>; |
87 | - |
88 | - explicit TilingWindowManager(FocusControllerFactory const& focus_controller) : |
89 | - focus_controller{focus_controller} |
90 | - { |
91 | - } |
92 | - |
93 | - auto place(ms::Session const& session, ms::SurfaceCreationParameters const& request_parameters) |
94 | - -> ms::SurfaceCreationParameters override |
95 | - { |
96 | - auto parameters = request_parameters; |
97 | - |
98 | - std::lock_guard<decltype(mutex)> lock(mutex); |
99 | - auto const ptile = session_info.find(&session); |
100 | - if (ptile != end(session_info)) |
101 | - { |
102 | - Rectangle const& tile = ptile->second.tile; |
103 | - parameters.top_left = parameters.top_left + (tile.top_left - Point{0, 0}); |
104 | - |
105 | - clip_to_tile(parameters, tile); |
106 | - } |
107 | - |
108 | - return parameters; |
109 | - } |
110 | - |
111 | - void add_surface( |
112 | - std::shared_ptr<ms::Surface> const& surface, |
113 | - ms::Session* session) override |
114 | - { |
115 | - std::lock_guard<decltype(mutex)> lock(mutex); |
116 | - session_info[session].surfaces.push_back(surface); |
117 | - surface_info[surface].session = session_info[session].session; |
118 | - surface_info[surface].state = mir_surface_state_restored; |
119 | - } |
120 | - |
121 | - void remove_surface( |
122 | - std::weak_ptr<ms::Surface> const& surface, |
123 | - ms::Session* session) override |
124 | - { |
125 | - std::lock_guard<decltype(mutex)> lock(mutex); |
126 | - auto& surfaces = session_info[session].surfaces; |
127 | - |
128 | - for (auto i = begin(surfaces); i != end(surfaces); ++i) |
129 | - { |
130 | - if (surface.lock() == i->lock()) |
131 | - { |
132 | - surfaces.erase(i); |
133 | - break; |
134 | - } |
135 | - } |
136 | - |
137 | - surface_info.erase(surface); |
138 | - } |
139 | - |
140 | - void add_session(std::shared_ptr<ms::Session> const& session) override |
141 | - { |
142 | - std::lock_guard<decltype(mutex)> lock(mutex); |
143 | - session_info[session.get()] = session; |
144 | - update_tiles(); |
145 | - } |
146 | - |
147 | - void remove_session(std::shared_ptr<ms::Session> const& session) override |
148 | - { |
149 | - std::lock_guard<decltype(mutex)> lock(mutex); |
150 | - session_info.erase(session.get()); |
151 | - update_tiles(); |
152 | - } |
153 | - |
154 | + using msh::AbstractShell::AbstractShell; |
155 | + |
156 | +private: |
157 | void add_display(Rectangle const& area) override |
158 | { |
159 | std::lock_guard<decltype(mutex)> lock(mutex); |
160 | @@ -188,7 +129,7 @@ |
161 | std::lock_guard<decltype(mutex)> lock(mutex); |
162 | |
163 | if (auto const session = session_under(cursor)) |
164 | - focus_controller()->set_focus_to(session); |
165 | + set_focus_to(session); |
166 | |
167 | old_cursor = cursor; |
168 | } |
169 | @@ -201,7 +142,7 @@ |
170 | { |
171 | if (session == session_under(old_cursor)) |
172 | { |
173 | - auto const& info = session_info[session.get()]; |
174 | + auto const& info = session_info[session]; |
175 | |
176 | if (drag(old_surface.lock(), cursor, old_cursor, info.tile)) |
177 | { |
178 | @@ -238,7 +179,7 @@ |
179 | { |
180 | if (session == session_under(old_cursor)) |
181 | { |
182 | - auto const& info = session_info[session.get()]; |
183 | + auto const& info = session_info[session]; |
184 | |
185 | if (resize(old_surface.lock(), cursor, old_cursor, info.tile)) |
186 | { |
187 | @@ -269,7 +210,7 @@ |
188 | |
189 | void toggle(MirSurfaceState state) override |
190 | { |
191 | - if (auto const focussed_session = focus_controller()->focussed_application().lock()) |
192 | + if (auto const focussed_session = focussed_application().lock()) |
193 | { |
194 | if (auto const focussed_surface = focussed_session->default_surface()) |
195 | { |
196 | @@ -280,31 +221,125 @@ |
197 | state = mir_surface_state_restored; |
198 | } |
199 | |
200 | - focussed_surface->configure(mir_surface_attrib_state, state); |
201 | - attribute_set(*focussed_surface, mir_surface_attrib_state, state); |
202 | + set_surface_attribute(focussed_session, focussed_surface, mir_surface_attrib_state, state); |
203 | } |
204 | } |
205 | } |
206 | |
207 | - int select_attribute_value(ms::Surface const&, MirSurfaceAttrib, int requested_value) override |
208 | - { return requested_value; } |
209 | - |
210 | - void attribute_set(ms::Surface const& surface, MirSurfaceAttrib attrib, int value) override |
211 | + std::shared_ptr<ms::Session> open_session( |
212 | + pid_t client_pid, |
213 | + std::string const& name, |
214 | + std::shared_ptr<mf::EventSink> const& sink) override |
215 | + { |
216 | + auto const result = msh::AbstractShell::open_session(client_pid, name, sink); |
217 | + add_session(result); |
218 | + return result; |
219 | + } |
220 | + |
221 | + void close_session(std::shared_ptr<ms::Session> const& session) override |
222 | + { |
223 | + remove_session(session); |
224 | + msh::AbstractShell::close_session(session); |
225 | + } |
226 | + |
227 | + mf::SurfaceId create_surface(std::shared_ptr<ms::Session> const& session, ms::SurfaceCreationParameters const& params) override |
228 | + { |
229 | + ms::SurfaceCreationParameters const placed_params = place_new_surface(session, params); |
230 | + auto const result = msh::AbstractShell::create_surface(session, placed_params); |
231 | + add_surface(session->surface(result), session); |
232 | + return result; |
233 | + } |
234 | + |
235 | + void destroy_surface(std::shared_ptr<ms::Session> const& session, mf::SurfaceId surface) override |
236 | + { |
237 | + remove_surface(session->surface(surface), session); |
238 | + msh::AbstractShell::destroy_surface(session, surface); |
239 | + } |
240 | + |
241 | + int set_surface_attribute( |
242 | + std::shared_ptr<ms::Session> const& session, |
243 | + std::shared_ptr<ms::Surface> const& surface, |
244 | + MirSurfaceAttrib attrib, |
245 | + int value) override |
246 | { |
247 | switch (attrib) |
248 | { |
249 | case mir_surface_attrib_state: |
250 | { |
251 | std::lock_guard<decltype(mutex)> lock(mutex); |
252 | - set_state(surface, value); |
253 | + set_state(surface, MirSurfaceState(value)); |
254 | break; |
255 | } |
256 | default: |
257 | break; |
258 | } |
259 | - } |
260 | - |
261 | -private: |
262 | + |
263 | + return msh::AbstractShell::set_surface_attribute(session, surface, attrib, value); |
264 | + } |
265 | + |
266 | + void add_session(std::shared_ptr<ms::Session> const& session) |
267 | + { |
268 | + std::lock_guard<decltype(mutex)> lock(mutex); |
269 | + session_info[session] = SessionInfo(); |
270 | + update_tiles(); |
271 | + } |
272 | + |
273 | + void remove_session(std::shared_ptr<ms::Session> const& session) |
274 | + { |
275 | + std::lock_guard<decltype(mutex)> lock(mutex); |
276 | + session_info.erase(session); |
277 | + update_tiles(); |
278 | + } |
279 | + |
280 | + auto place_new_surface( |
281 | + std::shared_ptr<ms::Session> const& session, |
282 | + ms::SurfaceCreationParameters const& request_parameters) |
283 | + -> ms::SurfaceCreationParameters |
284 | + { |
285 | + auto parameters = request_parameters; |
286 | + |
287 | + std::lock_guard<decltype(mutex)> lock(mutex); |
288 | + auto const ptile = session_info.find(session); |
289 | + if (ptile != end(session_info)) |
290 | + { |
291 | + Rectangle const& tile = ptile->second.tile; |
292 | + parameters.top_left = parameters.top_left + (tile.top_left - Point{0, 0}); |
293 | + |
294 | + clip_to_tile(parameters, tile); |
295 | + } |
296 | + |
297 | + return parameters; |
298 | + } |
299 | + |
300 | + void add_surface( |
301 | + std::shared_ptr<ms::Surface> const& surface, |
302 | + std::shared_ptr<ms::Session> const& session) |
303 | + { |
304 | + std::lock_guard<decltype(mutex)> lock(mutex); |
305 | + session_info[session].surfaces.push_back(surface); |
306 | + surface_info[surface].session = session; |
307 | + surface_info[surface].state = mir_surface_state_restored; |
308 | + } |
309 | + |
310 | + void remove_surface( |
311 | + std::weak_ptr<ms::Surface> const& surface, |
312 | + std::shared_ptr<ms::Session> const& session) |
313 | + { |
314 | + std::lock_guard<decltype(mutex)> lock(mutex); |
315 | + auto& surfaces = session_info[session].surfaces; |
316 | + |
317 | + for (auto i = begin(surfaces); i != end(surfaces); ++i) |
318 | + { |
319 | + if (surface.lock() == i->lock()) |
320 | + { |
321 | + surfaces.erase(i); |
322 | + break; |
323 | + } |
324 | + } |
325 | + |
326 | + surface_info.erase(surface); |
327 | + } |
328 | + |
329 | void update_tiles() |
330 | { |
331 | if (session_info.size() < 1 || displays.size() < 1) return; |
332 | @@ -333,7 +368,7 @@ |
333 | } |
334 | } |
335 | |
336 | - void update_surfaces(ms::Session const* session, Rectangle const& old_tile, Rectangle const& new_tile) |
337 | + void update_surfaces(std::weak_ptr<ms::Session> const& session, Rectangle const& old_tile, Rectangle const& new_tile) |
338 | { |
339 | auto displacement = new_tile.top_left - old_tile.top_left; |
340 | auto& info = session_info[session]; |
341 | @@ -447,83 +482,61 @@ |
342 | Rectangle restore_rect; |
343 | }; |
344 | |
345 | - void set_state(ms::Surface const& surface, int value) |
346 | + void set_state(std::shared_ptr<ms::Surface> const& surface, MirSurfaceState value) |
347 | { |
348 | - auto new_state = mir_surface_state_restored; |
349 | - |
350 | switch (value) |
351 | { |
352 | case mir_surface_state_restored: |
353 | - new_state = mir_surface_state_restored; |
354 | - break; |
355 | - |
356 | case mir_surface_state_maximized: |
357 | - new_state = mir_surface_state_maximized; |
358 | - break; |
359 | - |
360 | case mir_surface_state_vertmaximized: |
361 | - new_state = mir_surface_state_vertmaximized; |
362 | - break; |
363 | - |
364 | case mir_surface_state_horizmaximized: |
365 | - new_state = mir_surface_state_horizmaximized; |
366 | break; |
367 | |
368 | default: |
369 | return; |
370 | } |
371 | |
372 | - for (auto& i : surface_info) |
373 | - { |
374 | - if (auto const sp = i.first.lock()) |
375 | - { |
376 | - if (sp.get() == &surface) |
377 | - { |
378 | - auto& surface_info = i.second; |
379 | - |
380 | - if (surface_info.state == mir_surface_state_restored) |
381 | - { |
382 | - surface_info.restore_rect = {sp->top_left(), sp->size()}; |
383 | - } |
384 | - |
385 | - if (surface_info.state == new_state) |
386 | - { |
387 | - return; // Nothing to do |
388 | - } |
389 | - |
390 | - auto const& session_info = |
391 | - this->session_info[surface_info.session.lock().get()]; |
392 | - |
393 | - switch (new_state) |
394 | - { |
395 | - case mir_surface_state_restored: |
396 | - sp->move_to(surface_info.restore_rect.top_left); |
397 | - sp->resize(surface_info.restore_rect.size); |
398 | - break; |
399 | - |
400 | - case mir_surface_state_maximized: |
401 | - sp->move_to(session_info.tile.top_left); |
402 | - sp->resize(session_info.tile.size); |
403 | - break; |
404 | - |
405 | - case mir_surface_state_horizmaximized: |
406 | - sp->move_to({session_info.tile.top_left.x, surface_info.restore_rect.top_left.y}); |
407 | - sp->resize({session_info.tile.size.width, surface_info.restore_rect.size.height}); |
408 | - break; |
409 | - |
410 | - case mir_surface_state_vertmaximized: |
411 | - sp->move_to({surface_info.restore_rect.top_left.x, session_info.tile.top_left.y}); |
412 | - sp->resize({surface_info.restore_rect.size.width, session_info.tile.size.height}); |
413 | - break; |
414 | - |
415 | - default: |
416 | - break; |
417 | - } |
418 | - |
419 | - surface_info.state = new_state; |
420 | - } |
421 | - } |
422 | - } |
423 | + auto& info = surface_info[surface]; |
424 | + |
425 | + if (info.state == mir_surface_state_restored) |
426 | + { |
427 | + info.restore_rect = {surface->top_left(), surface->size()}; |
428 | + } |
429 | + |
430 | + if (info.state == value) |
431 | + { |
432 | + return; // Nothing to do |
433 | + } |
434 | + |
435 | + auto const& tile = this->session_info[info.session].tile; |
436 | + |
437 | + switch (value) |
438 | + { |
439 | + case mir_surface_state_restored: |
440 | + surface->move_to(info.restore_rect.top_left); |
441 | + surface->resize(info.restore_rect.size); |
442 | + break; |
443 | + |
444 | + case mir_surface_state_maximized: |
445 | + surface->move_to(tile.top_left); |
446 | + surface->resize(tile.size); |
447 | + break; |
448 | + |
449 | + case mir_surface_state_horizmaximized: |
450 | + surface->move_to({tile.top_left.x, info.restore_rect.top_left.y}); |
451 | + surface->resize({tile.size.width, info.restore_rect.size.height}); |
452 | + break; |
453 | + |
454 | + case mir_surface_state_vertmaximized: |
455 | + surface->move_to({info.restore_rect.top_left.x, tile.top_left.y}); |
456 | + surface->resize({info.restore_rect.size.width, tile.size.height}); |
457 | + break; |
458 | + |
459 | + default: |
460 | + break; |
461 | + } |
462 | + |
463 | + info.state = value; |
464 | } |
465 | |
466 | std::shared_ptr<ms::Session> session_under(Point position) |
467 | @@ -532,7 +545,7 @@ |
468 | { |
469 | if (info.second.tile.contains(position)) |
470 | { |
471 | - return info.second.session.lock(); |
472 | + return info.first.lock(); |
473 | } |
474 | } |
475 | |
476 | @@ -541,24 +554,14 @@ |
477 | |
478 | struct SessionInfo |
479 | { |
480 | - SessionInfo() = default; |
481 | - SessionInfo& operator=(std::weak_ptr<ms::Session> const& session) |
482 | - { |
483 | - this->session = session; |
484 | - surfaces.clear(); |
485 | - return *this; |
486 | - } |
487 | - std::weak_ptr<ms::Session> session; |
488 | Rectangle tile; |
489 | std::vector<std::weak_ptr<ms::Surface>> surfaces; |
490 | }; |
491 | |
492 | - FocusControllerFactory const focus_controller; |
493 | - |
494 | std::mutex mutex; |
495 | Rectangles displays; |
496 | |
497 | - std::map<ms::Session const*, SessionInfo> session_info; |
498 | + std::map<std::weak_ptr<ms::Session>, SessionInfo, std::owner_less<std::weak_ptr<ms::Session>>> session_info; |
499 | std::map<std::weak_ptr<ms::Surface>, SurfaceInfo, std::owner_less<std::weak_ptr<ms::Surface>>> surface_info; |
500 | |
501 | Point old_cursor{}; |
502 | @@ -686,11 +689,19 @@ |
503 | |
504 | if (selection == wm_tiling) |
505 | { |
506 | - auto focus_controller_factory = [this] { return server.the_focus_controller(); }; |
507 | - tmp = std::make_shared<TilingWindowManager>(focus_controller_factory); |
508 | + tmp = std::make_shared<TilingWindowManager>( |
509 | + server.the_input_targeter(), |
510 | + server.the_surface_coordinator(), |
511 | + server.the_session_coordinator(), |
512 | + server.the_prompt_session_manager()); |
513 | } |
514 | else if (selection == wm_fullscreen) |
515 | - tmp = std::make_shared<FullscreenWindowManager>(server.the_shell_display_layout()); |
516 | + tmp = std::make_shared<FullscreenWindowManager>( |
517 | + server.the_input_targeter(), |
518 | + server.the_surface_coordinator(), |
519 | + server.the_session_coordinator(), |
520 | + server.the_prompt_session_manager(), |
521 | + server.the_shell_display_layout()); |
522 | else |
523 | throw mir::AbnormalExit("Unknown window manager: " + selection); |
524 | |
525 | |
526 | === modified file 'examples/server_example_window_management.h' |
527 | --- examples/server_example_window_management.h 2015-01-16 02:57:31 +0000 |
528 | +++ examples/server_example_window_management.h 2015-02-03 10:48:32 +0000 |
529 | @@ -20,11 +20,7 @@ |
530 | #define MIR_EXAMPLES_WINDOW_MANAGEMENT_H_ |
531 | |
532 | #include "mir/geometry/rectangles.h" |
533 | -#include "mir/scene/session.h" |
534 | -#include "mir/scene/surface.h" |
535 | -#include "mir/scene/placement_strategy.h" |
536 | -#include "mir/scene/surface_configurator.h" |
537 | -#include "mir/scene/surface_creation_parameters.h" |
538 | +#include "mir/shell/shell.h" |
539 | #include "mir_toolkit/common.h" |
540 | |
541 | #include <memory> |
542 | @@ -38,24 +34,9 @@ |
543 | |
544 | namespace examples |
545 | { |
546 | -class WindowManager : |
547 | - public virtual scene::PlacementStrategy, |
548 | - public virtual scene::SurfaceConfigurator |
549 | +class WindowManager : public virtual shell::Shell |
550 | { |
551 | public: |
552 | - |
553 | - virtual void add_surface( |
554 | - std::shared_ptr<scene::Surface> const& surface, |
555 | - scene::Session* session) = 0; |
556 | - |
557 | - virtual void remove_surface( |
558 | - std::weak_ptr<scene::Surface> const& surface, |
559 | - scene::Session* session) = 0; |
560 | - |
561 | - virtual void add_session(std::shared_ptr<scene::Session> const& session) = 0; |
562 | - |
563 | - virtual void remove_session(std::shared_ptr<scene::Session> const& session) = 0; |
564 | - |
565 | virtual void add_display(geometry::Rectangle const& area) = 0; |
566 | |
567 | virtual void remove_display(geometry::Rectangle const& area) = 0; |
568 | |
569 | === modified file 'examples/server_example_window_manager.cpp' |
570 | --- examples/server_example_window_manager.cpp 2015-01-15 03:30:48 +0000 |
571 | +++ examples/server_example_window_manager.cpp 2015-02-03 10:48:32 +0000 |
572 | @@ -24,12 +24,12 @@ |
573 | #include "mir/compositor/display_buffer_compositor.h" |
574 | #include "mir/graphics/display_buffer.h" |
575 | #include "mir/options/option.h" |
576 | -#include "mir/scene/session_listener.h" |
577 | |
578 | namespace mc = mir::compositor; |
579 | namespace me = mir::examples; |
580 | namespace mg = mir::graphics; |
581 | namespace ms = mir::scene; |
582 | +namespace msh = mir::shell; |
583 | using namespace mir::geometry; |
584 | |
585 | ///\example server_example_window_manager.cpp |
586 | @@ -37,42 +37,6 @@ |
587 | |
588 | namespace |
589 | { |
590 | -class SceneTracker : public ms::SessionListener |
591 | -{ |
592 | -public: |
593 | - SceneTracker(std::shared_ptr<me::WindowManager> const& window_manager) : |
594 | - window_manager(window_manager) |
595 | - { |
596 | - } |
597 | - |
598 | -private: |
599 | - |
600 | - void starting(std::shared_ptr<ms::Session> const& session) override |
601 | - { |
602 | - window_manager->add_session(session); |
603 | - } |
604 | - |
605 | - void stopping(std::shared_ptr<ms::Session> const& session) override |
606 | - { |
607 | - window_manager->remove_session(session); |
608 | - } |
609 | - |
610 | - void focused(std::shared_ptr<ms::Session> const& /*session*/) override {} |
611 | - void unfocused() override {} |
612 | - |
613 | - void surface_created(ms::Session& session, std::shared_ptr<ms::Surface> const& surface) override |
614 | - { |
615 | - window_manager->add_surface(surface, &session); |
616 | - } |
617 | - |
618 | - void destroying_surface(ms::Session& session, std::shared_ptr<ms::Surface> const& surface) override |
619 | - { |
620 | - window_manager->remove_surface(surface, &session); |
621 | - } |
622 | - |
623 | - std::shared_ptr<me::WindowManager> const window_manager; |
624 | -}; |
625 | - |
626 | class DisplayTracker : public mc::DisplayBufferCompositor |
627 | { |
628 | public: |
629 | @@ -134,35 +98,13 @@ |
630 | |
631 | auto const factory = std::make_shared<me::WindowManagmentFactory>(server); |
632 | |
633 | - server.override_the_placement_strategy([factory, &server]() |
634 | - -> std::shared_ptr<ms::PlacementStrategy> |
635 | - { |
636 | - auto const options = server.get_options(); |
637 | - |
638 | - if (!options->is_set(me::wm_option)) |
639 | - return std::shared_ptr<ms::PlacementStrategy>{}; |
640 | - |
641 | - return factory->window_manager(); |
642 | - }); |
643 | - |
644 | - server.override_the_session_listener([factory, &server]() |
645 | - -> std::shared_ptr<ms::SessionListener> |
646 | - { |
647 | - auto const options = server.get_options(); |
648 | - |
649 | - if (!options->is_set(me::wm_option)) |
650 | - return std::shared_ptr<ms::SessionListener>{}; |
651 | - |
652 | - return std::make_shared<SceneTracker>(factory->window_manager()); |
653 | - }); |
654 | - |
655 | - server.override_the_surface_configurator([factory, &server]() |
656 | - -> std::shared_ptr<ms::SurfaceConfigurator> |
657 | - { |
658 | - auto const options = server.get_options(); |
659 | - |
660 | - if (!options->is_set(me::wm_option)) |
661 | - return std::shared_ptr<ms::SurfaceConfigurator>{}; |
662 | + server.override_the_shell([factory, &server]() |
663 | + -> std::shared_ptr<msh::Shell> |
664 | + { |
665 | + auto const options = server.get_options(); |
666 | + |
667 | + if (!options->is_set(me::wm_option)) |
668 | + return std::shared_ptr<msh::Shell>{}; |
669 | |
670 | return factory->window_manager(); |
671 | }); |
FAILED: Continuous integration, rev:2288 jenkins. qa.ubuntu. com/job/ mir-ci/ 2868/ jenkins. qa.ubuntu. com/job/ mir-android- vivid-i386- build/1145 jenkins. qa.ubuntu. com/job/ mir-clang- vivid-amd64- build/1144/ console jenkins. qa.ubuntu. com/job/ mir-mediumtests -vivid- touch/1106 jenkins. qa.ubuntu. com/job/ mir-vivid- amd64-ci/ 865 jenkins. qa.ubuntu. com/job/ mir-vivid- amd64-ci/ 865/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ mir-mediumtests -builder- vivid-armhf/ 1106 jenkins. qa.ubuntu. com/job/ mir-mediumtests -builder- vivid-armhf/ 1106/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ mir-mediumtests -runner- mako/4159 s-jenkins. ubuntu- ci:8080/ job/touch- flash-device/ 17649
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/mir- ci/2868/ rebuild
http://