Mir

Merge lp:~alan-griffiths/mir/remove-DefaultWindowManager into lp:mir

Proposed by Alan Griffiths
Status: Merged
Approved by: Daniel van Vugt
Approved revision: no longer in the source branch.
Merged at revision: 3489
Proposed branch: lp:~alan-griffiths/mir/remove-DefaultWindowManager
Merge into: lp:mir
Diff against target: 404 lines (+5/-304)
6 files modified
playground/demo-shell/CMakeLists.txt (+0/-1)
playground/demo-shell/default_window_manager.cpp (+0/-150)
playground/demo-shell/default_window_manager.h (+0/-86)
playground/demo-shell/demo_shell.cpp (+5/-53)
playground/server_configuration.cpp (+0/-8)
playground/server_configuration.h (+0/-6)
To merge this branch: bzr merge lp:~alan-griffiths/mir/remove-DefaultWindowManager
Reviewer Review Type Date Requested Status
Mir CI Bot continuous-integration Approve
Daniel van Vugt Approve
Kevin DuBois (community) Approve
Cemil Azizoglu (community) Approve
Review via email: mp+292779@code.launchpad.net

Commit message

playground: get rid of the legacy DefaultWindowManager (and the --window-manager option) in mir_proving_server

Description of the change

playground: get rid of the legacy DefaultWindowManager (and the --window-manager option) in mir_proving_server

We have too many window managers around the system, and this one is pointless

To post a comment you must log in.
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:3476
https://mir-jenkins.ubuntu.com/job/mir-ci/895/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/931
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/970
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/961
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/961
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/941
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/941/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/941
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/941/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/941
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/941/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/941
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/941/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/941
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/941/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/895/rebuild

review: Approve (continuous-integration)
Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote :

Yep.. Too many.

review: Approve
Revision history for this message
Kevin DuBois (kdub) wrote :

alright

review: Approve
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

I was wondering why that was there... In theory: Approved.

In practice: Manual testing of this branch reveals that it breaks mir_proving_server's nice reliable resizing and moving. So I would prefer that we fix bug 1447886 before introducing it into mir_proving_server that is presently immune to bug 1447886.

review: Needs Fixing
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> I was wondering why that was there... In theory: Approved.
>
> In practice: Manual testing of this branch reveals that it breaks
> mir_proving_server's nice reliable resizing and moving. So I would prefer that
> we fix bug 1447886 before introducing it into mir_proving_server that is
> presently immune to bug 1447886.

AFAICS the principle difference is that the "canonical" window manager expects you to click on a window to resize or move it. (And, if you chose to size to 1x1 that can be tricky - but not impossible.)

In contrast mir_proving_server the window management currently resizes or moves the active window regardless of where you click. This happens even when you click on another window on another screen.

I'm not sure that the latter behaviour is worth preserving.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

It's not a show-stopper. And I really like the gist of this proposal. But I personally request that we don't break mir_proving_server till more bugs in the canonical window manager are fixed.

If this MP landed it would only motivate me to take a tangent and spend time fixing the canonical window manager, which I don't want to do. More details are in bug 1447886.

Also relevant is: https://trello.com/c/Ru4bK7J4

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> It's not a show-stopper. And I really like the gist of this proposal. But I
> personally request that we don't break mir_proving_server till more bugs in
> the canonical window manager are fixed.
>
> If this MP landed it would only motivate me to take a tangent and spend time
> fixing the canonical window manager, which I don't want to do. More details
> are in bug 1447886.

I've tried addressing your concerns in lp:~alan-griffiths/miral/revised-resize/+merge/293125

If that addresses your concerns we can proceed with this MP and I'll backport to Mir's CanonicalWindowManager.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

It sounds good in theory (I haven't tested it). Land that one, and then let's see how this goes.

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> It sounds good in theory (I haven't tested it). Land that one, and then let's
> see how this goes.

You can see the effect by trying lp:~alan-griffiths/mir/fix-1447886 with:

  $ bin/mir_proving_server --window-manager canonical

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

I have a better theory - just let playground's WindowManager filter events first. That way the behaviour of proving_server doesn't change.

Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:3478
https://mir-jenkins.ubuntu.com/job/mir-ci/921/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/974/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/1020
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1011
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/1011
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/984
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/984/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/984
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/984/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/984
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/984/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/984
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/984/artifact/output/*zip*/output.zip
    ABORTED: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/984/console

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/921/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

13:17:36 Build timed out (after 180 minutes). Marking the build as aborted.
13:17:36 Build was aborted
13:17:36 Archiving artifacts
13:17:36 [WS-CLEANUP] Deleting project workspace...[WS-CLEANUP] done
13:17:36 Finished: ABORTED

Rebuild triggered

Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:3478
https://mir-jenkins.ubuntu.com/job/mir-ci/925/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/978/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/1024
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1015
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/1015
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/988
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/988/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/988
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/988/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/988
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/988/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/988
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/988/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/988/console

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/925/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:3478
https://mir-jenkins.ubuntu.com/job/mir-ci/926/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/979/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/1025
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1016
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/1016
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/989
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/989/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/989
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/989/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/989
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/989/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/989
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/989/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/989/console

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/926/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Sure, looks like a good (smaller) step.

review: Approve
Revision history for this message
Mir CI Bot (mir-ci-bot) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'playground/demo-shell/CMakeLists.txt'
--- playground/demo-shell/CMakeLists.txt 2015-06-24 03:00:56 +0000
+++ playground/demo-shell/CMakeLists.txt 2016-04-29 10:12:03 +0000
@@ -2,7 +2,6 @@
2 demo_compositor.cpp2 demo_compositor.cpp
3 demo_renderer.cpp3 demo_renderer.cpp
4 window_manager.cpp4 window_manager.cpp
5 default_window_manager.cpp
6)5)
76
8add_subdirectory(typo)7add_subdirectory(typo)
98
=== removed file 'playground/demo-shell/default_window_manager.cpp'
--- playground/demo-shell/default_window_manager.cpp 2016-01-29 08:18:22 +0000
+++ playground/demo-shell/default_window_manager.cpp 1970-01-01 00:00:00 +0000
@@ -1,150 +0,0 @@
1/*
2 * Copyright © 2015 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored By: Alan Griffiths <alan@octopull.co.uk>
17 */
18
19#include "default_window_manager.h"
20
21#include "mir/scene/session.h"
22#include "mir/scene/session_coordinator.h"
23#include "mir/scene/surface.h"
24#include "mir/scene/surface_creation_parameters.h"
25#include "mir/shell/display_layout.h"
26#include "mir/shell/focus_controller.h"
27#include "mir/shell/surface_ready_observer.h"
28#include "mir/shell/surface_specification.h"
29
30#include "mir_toolkit/client_types.h"
31
32namespace mf = mir::frontend;
33namespace ms = mir::scene;
34namespace msh = mir::shell;
35namespace me = mir::examples;
36namespace geom = mir::geometry;
37
38me::DefaultWindowManager::DefaultWindowManager(
39 msh::FocusController* focus_controller,
40 std::shared_ptr<shell::DisplayLayout> const& display_layout,
41 std::shared_ptr<scene::SessionCoordinator> const& session_coordinator) :
42 focus_controller{focus_controller},
43 display_layout{display_layout},
44 session_coordinator{session_coordinator}
45{
46}
47
48void me::DefaultWindowManager::add_session(std::shared_ptr<scene::Session> const& session)
49{
50 focus_controller->set_focus_to(session, {});
51}
52
53void me::DefaultWindowManager::remove_session(std::shared_ptr<scene::Session> const& /*session*/)
54{
55 auto const next_session = session_coordinator->successor_of({});
56 if (next_session)
57 focus_controller->set_focus_to(next_session, next_session->default_surface());
58 else
59 focus_controller->set_focus_to(next_session, {});
60}
61
62auto me::DefaultWindowManager::add_surface(
63 std::shared_ptr<scene::Session> const& session,
64 scene::SurfaceCreationParameters const& request_parameters,
65 std::function<frontend::SurfaceId(std::shared_ptr<scene::Session> const& session, scene::SurfaceCreationParameters const& params)> const& build)
66-> frontend::SurfaceId
67{
68 mir::graphics::DisplayConfigurationOutputId const output_id_invalid{
69 mir_display_output_id_invalid};
70 auto placed_parameters = request_parameters;
71
72 geom::Rectangle rect{request_parameters.top_left, request_parameters.size};
73
74 if (request_parameters.output_id != output_id_invalid)
75 {
76 display_layout->place_in_output(request_parameters.output_id, rect);
77 }
78
79 placed_parameters.top_left = rect.top_left;
80 placed_parameters.size = rect.size;
81
82 auto const result = build(session, placed_parameters);
83 auto const surface = session->surface(result);
84
85 surface->add_observer(std::make_shared<msh::SurfaceReadyObserver>(
86 [this](std::shared_ptr<scene::Session> const& session,
87 std::shared_ptr<scene::Surface> const& surface)
88 {
89 focus_controller->set_focus_to(session, surface);
90 },
91 session,
92 surface));
93
94 return result;
95}
96
97void me::DefaultWindowManager::modify_surface(
98 std::shared_ptr<scene::Session> const& /*session*/,
99 std::shared_ptr<scene::Surface> const& surface,
100 msh::SurfaceSpecification const& modifications)
101{
102 if (modifications.name.is_set())
103 surface->rename(modifications.name.value());
104}
105
106void me::DefaultWindowManager::remove_surface(
107 std::shared_ptr<scene::Session> const& session,
108 std::weak_ptr<scene::Surface> const& surface)
109{
110 session->destroy_surface(surface);
111}
112
113void me::DefaultWindowManager::add_display(geometry::Rectangle const& /*area*/)
114{
115}
116
117void me::DefaultWindowManager::remove_display(geometry::Rectangle const& /*area*/)
118{
119}
120
121void me::DefaultWindowManager::handle_raise_surface(
122 std::shared_ptr<scene::Session> const& /*session*/,
123 std::shared_ptr<scene::Surface> const& /*surface*/,
124 uint64_t /*timestamp*/)
125{
126}
127
128bool me::DefaultWindowManager::handle_keyboard_event(MirKeyboardEvent const* /*event*/)
129{
130 return false;
131}
132
133bool me::DefaultWindowManager::handle_touch_event(MirTouchEvent const* /*event*/)
134{
135 return false;
136}
137
138bool me::DefaultWindowManager::handle_pointer_event(MirPointerEvent const* /*event*/)
139{
140 return false;
141}
142
143int me::DefaultWindowManager::set_surface_attribute(
144 std::shared_ptr<scene::Session> const& /*session*/,
145 std::shared_ptr<scene::Surface> const& surface,
146 MirSurfaceAttrib attrib,
147 int value)
148{
149 return surface->configure(attrib, value);
150}
1510
=== removed file 'playground/demo-shell/default_window_manager.h'
--- playground/demo-shell/default_window_manager.h 2016-01-29 08:18:22 +0000
+++ playground/demo-shell/default_window_manager.h 1970-01-01 00:00:00 +0000
@@ -1,86 +0,0 @@
1/*
2 * Copyright © 2015 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored By: Alan Griffiths <alan@octopull.co.uk>
17 */
18
19#ifndef MIR_EXAMPLES_DEFAULT_WINDOW_MANAGER_H_
20#define MIR_EXAMPLES_DEFAULT_WINDOW_MANAGER_H_
21
22#include "mir/shell/window_manager.h"
23
24namespace mir
25{
26namespace scene { class SessionCoordinator; }
27
28namespace shell { class FocusController; class DisplayLayout; }
29
30namespace examples
31{
32class DefaultWindowManager : public shell::WindowManager
33{
34public:
35 explicit DefaultWindowManager(shell::FocusController* focus_controller,
36 std::shared_ptr<shell::DisplayLayout> const& display_layout,
37 std::shared_ptr<scene::SessionCoordinator> const& session_coordinator);
38
39 void add_session(std::shared_ptr<scene::Session> const& session) override;
40
41 void remove_session(std::shared_ptr<scene::Session> const& session) override;
42
43 frontend::SurfaceId add_surface(
44 std::shared_ptr<scene::Session> const& session,
45 scene::SurfaceCreationParameters const& params,
46 std::function<frontend::SurfaceId(std::shared_ptr<scene::Session> const& session, scene::SurfaceCreationParameters const& params)> const& build) override;
47
48 void modify_surface(
49 std::shared_ptr<scene::Session> const& session,
50 std::shared_ptr<scene::Surface> const& surface,
51 shell::SurfaceSpecification const& modifications) override;
52
53 void remove_surface(
54 std::shared_ptr<scene::Session> const& session,
55 std::weak_ptr<scene::Surface> const& surface) override;
56
57 void add_display(geometry::Rectangle const& area) override;
58
59 void remove_display(geometry::Rectangle const& area) override;
60
61 bool handle_keyboard_event(MirKeyboardEvent const* event) override;
62
63 bool handle_touch_event(MirTouchEvent const* event) override;
64
65 bool handle_pointer_event(MirPointerEvent const* event) override;
66
67 void handle_raise_surface(
68 std::shared_ptr<scene::Session> const& session,
69 std::shared_ptr<scene::Surface> const& surface,
70 uint64_t timestamp) override;
71
72 int set_surface_attribute(
73 std::shared_ptr<scene::Session> const& session,
74 std::shared_ptr<scene::Surface> const& surface,
75 MirSurfaceAttrib attrib,
76 int value) override;
77
78private:
79 shell::FocusController* const focus_controller;
80 std::shared_ptr<shell::DisplayLayout> const display_layout;
81 std::shared_ptr<scene::SessionCoordinator> const session_coordinator;
82};
83}
84}
85
86#endif /* MIR_SHELL_DEFAULT_WINDOW_MANAGER_H_ */
870
=== modified file 'playground/demo-shell/demo_shell.cpp'
--- playground/demo-shell/demo_shell.cpp 2016-01-29 08:18:22 +0000
+++ playground/demo-shell/demo_shell.cpp 2016-04-29 10:12:03 +0000
@@ -29,9 +29,6 @@
29#include "mir/compositor/display_buffer_compositor_factory.h"29#include "mir/compositor/display_buffer_compositor_factory.h"
30#include "mir/compositor/renderer_factory.h"30#include "mir/compositor/renderer_factory.h"
31#include "mir/options/option.h"31#include "mir/options/option.h"
32#include "default_window_manager.h"
33#include "server_example_tiling_window_manager.h"
34#include "mir/shell/canonical_window_manager.h"
35#include "server_example_host_lifecycle_event_listener.h"32#include "server_example_host_lifecycle_event_listener.h"
3633
37#include <iostream>34#include <iostream>
@@ -71,13 +68,7 @@
71class DemoServerConfiguration : public mir::examples::ServerConfiguration68class DemoServerConfiguration : public mir::examples::ServerConfiguration
72{69{
73public:70public:
74 DemoServerConfiguration(int argc, char const* argv[],71 using mir::examples::ServerConfiguration::ServerConfiguration;
75 std::initializer_list<std::shared_ptr<mi::EventFilter>> const& filter_list)
76 : ServerConfiguration(argc, argv),
77 filter_list(filter_list)
78 {
79 }
80
8172
82 std::shared_ptr<compositor::DisplayBufferCompositorFactory> the_display_buffer_compositor_factory() override73 std::shared_ptr<compositor::DisplayBufferCompositorFactory> the_display_buffer_compositor_factory() override
83 {74 {
@@ -89,45 +80,6 @@
89 });80 });
90 }81 }
9182
92 std::shared_ptr<mi::CompositeEventFilter> the_composite_event_filter() override
93 {
94 return composite_event_filter(
95 [this]() -> std::shared_ptr<mi::CompositeEventFilter>
96 {
97 auto composite_filter = ServerConfiguration::the_composite_event_filter();
98 for (auto const& filter : filter_list)
99 composite_filter->append(filter);
100
101 return composite_filter;
102 });
103 }
104
105 auto the_window_manager_builder() -> shell::WindowManagerBuilder override
106 {
107 return [this](shell::FocusController* focus_controller)
108 -> std::shared_ptr<msh::WindowManager>
109 {
110 auto const options = the_options();
111 auto const selection = options->get<std::string>(wm_option);
112
113 if (selection == wm_tiling)
114 {
115 return std::make_shared<TilingWindowManager>(focus_controller);
116 }
117 else if (selection == wm_canonical)
118 {
119 return std::make_shared<msh::CanonicalWindowManager>(
120 focus_controller,
121 the_shell_display_layout());
122 }
123
124 return std::make_shared<DefaultWindowManager>(
125 focus_controller,
126 the_shell_display_layout(),
127 the_session_coordinator());
128 };
129 }
130
131 std::shared_ptr<msh::HostLifecycleEventListener> the_host_lifecycle_event_listener() override83 std::shared_ptr<msh::HostLifecycleEventListener> the_host_lifecycle_event_listener() override
132 {84 {
133 return host_lifecycle_event_listener(85 return host_lifecycle_event_listener(
@@ -136,9 +88,6 @@
136 return std::make_shared<HostLifecycleEventListener>(the_logger());88 return std::make_shared<HostLifecycleEventListener>(the_logger());
137 });89 });
138 }90 }
139
140private:
141 std::vector<std::shared_ptr<mi::EventFilter>> const filter_list;
142};91};
14392
144}93}
@@ -147,8 +96,9 @@
147int main(int argc, char const* argv[])96int main(int argc, char const* argv[])
148try97try
149{98{
99 me::DemoServerConfiguration config(argc, argv);
100
150 auto wm = std::make_shared<me::WindowManager>();101 auto wm = std::make_shared<me::WindowManager>();
151 me::DemoServerConfiguration config(argc, argv, {wm});
152102
153 mir::run_mir(config, [&config, &wm](mir::DisplayServer&)103 mir::run_mir(config, [&config, &wm](mir::DisplayServer&)
154 {104 {
@@ -158,6 +108,8 @@
158 wm->set_display(config.the_display());108 wm->set_display(config.the_display());
159 wm->set_compositor(config.the_compositor());109 wm->set_compositor(config.the_compositor());
160 wm->set_input_scene(config.the_input_scene());110 wm->set_input_scene(config.the_input_scene());
111
112 config.the_composite_event_filter()->prepend(wm);
161 });113 });
162 return 0;114 return 0;
163}115}
164116
=== modified file 'playground/server_configuration.cpp'
--- playground/server_configuration.cpp 2015-06-25 13:43:43 +0000
+++ playground/server_configuration.cpp 2016-04-29 10:12:03 +0000
@@ -28,12 +28,6 @@
28namespace me = mir::examples;28namespace me = mir::examples;
29namespace mg = mir::graphics;29namespace mg = mir::graphics;
3030
31char const* const me::wm_option = "window-manager";
32char const* const me::wm_description = "window management strategy [{legacy|canonical|tiling}]";
33char const* const me::wm_tiling = "tiling";
34char const* const me::wm_legacy = "legacy";
35char const* const me::wm_canonical = "canonical";
36
37me::ServerConfiguration::ServerConfiguration(std::shared_ptr<options::DefaultConfiguration> const& configuration_options) :31me::ServerConfiguration::ServerConfiguration(std::shared_ptr<options::DefaultConfiguration> const& configuration_options) :
38 DefaultServerConfiguration(configuration_options)32 DefaultServerConfiguration(configuration_options)
39{33{
@@ -42,8 +36,6 @@
42 configuration_options->add_options()36 configuration_options->add_options()
43 (me::display_config_opt, po::value<std::string>()->default_value(me::clone_opt_val),37 (me::display_config_opt, po::value<std::string>()->default_value(me::clone_opt_val),
44 me::display_config_descr);38 me::display_config_descr);
45 configuration_options->add_options()
46 (wm_option, po::value<std::string>()->default_value(wm_legacy), wm_description);
47}39}
4840
49me::ServerConfiguration::ServerConfiguration(int argc, char const** argv) :41me::ServerConfiguration::ServerConfiguration(int argc, char const** argv) :
5042
=== modified file 'playground/server_configuration.h'
--- playground/server_configuration.h 2015-06-17 05:20:42 +0000
+++ playground/server_configuration.h 2016-04-29 10:12:03 +0000
@@ -43,12 +43,6 @@
43private:43private:
44 std::shared_ptr<input::EventFilter> quit_filter;44 std::shared_ptr<input::EventFilter> quit_filter;
45};45};
46
47extern char const* const wm_option;
48extern char const* const wm_description;
49extern char const* const wm_tiling;
50extern char const* const wm_legacy;
51extern char const* const wm_canonical;
52}46}
53}47}
5448

Subscribers

People subscribed via source and target branches