~alan-griffiths/mir/fix-1654023

« back to all changes in this revision

Viewing changes to playground/demo-shell/demo_shell.cpp

  • Committer: Daniel van Vugt
  • Date: 2015-04-28 07:54:10 UTC
  • mfrom: (2517 development-branch)
  • mto: This revision was merged to the branch mainline in revision 2673.
  • Revision ID: daniel.van.vugt@canonical.com-20150428075410-rwskshfuar7voesp
Merge latest trunk and fix conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
#include "demo_compositor.h"
22
22
#include "window_manager.h"
23
 
#include "server_example_fullscreen_placement_strategy.h"
24
23
#include "../server_configuration.h"
25
24
 
26
 
#include "mir/options/default_configuration.h"
27
25
#include "mir/run_mir.h"
28
26
#include "mir/report_exception.h"
29
27
#include "mir/graphics/display.h"
31
29
#include "mir/compositor/display_buffer_compositor_factory.h"
32
30
#include "mir/compositor/destination_alpha.h"
33
31
#include "mir/compositor/renderer_factory.h"
 
32
#include "mir/shell/default_window_manager.h"
34
33
#include "server_example_host_lifecycle_event_listener.h"
35
34
 
36
35
#include <iostream>
40
39
namespace mg = mir::graphics;
41
40
namespace mf = mir::frontend;
42
41
namespace mi = mir::input;
43
 
namespace mo = mir::options;
44
42
namespace mc = mir::compositor;
45
43
namespace msh = mir::shell;
46
44
 
74
72
public:
75
73
    DemoServerConfiguration(int argc, char const* argv[],
76
74
                            std::initializer_list<std::shared_ptr<mi::EventFilter>> const& filter_list)
77
 
      : ServerConfiguration([argc, argv]
78
 
        {
79
 
            auto result = std::make_shared<mo::DefaultConfiguration>(argc, argv);
80
 
 
81
 
            namespace po = boost::program_options;
82
 
 
83
 
            result->add_options()
84
 
                ("fullscreen-surfaces", "Make all surfaces fullscreen");
85
 
 
86
 
            return result;
87
 
        }()),
 
75
      : ServerConfiguration(argc, argv),
88
76
        filter_list(filter_list)
89
77
    {
90
78
    }
100
88
            });
101
89
    }
102
90
 
103
 
    std::shared_ptr<ms::PlacementStrategy> the_placement_strategy() override
104
 
    {
105
 
        return placement_strategy(
106
 
            [this]() -> std::shared_ptr<ms::PlacementStrategy>
107
 
            {
108
 
                if (the_options()->is_set("fullscreen-surfaces"))
109
 
                    return std::make_shared<me::FullscreenPlacementStrategy>(the_shell_display_layout());
110
 
                else
111
 
                    return DefaultServerConfiguration::the_placement_strategy();
112
 
            });
113
 
    }
114
 
 
115
91
    std::shared_ptr<mi::CompositeEventFilter> the_composite_event_filter() override
116
92
    {
117
 
        auto composite_filter = ServerConfiguration::the_composite_event_filter();
118
 
        for (auto const& filter : filter_list)
119
 
            composite_filter->append(filter);
120
 
 
121
 
        return composite_filter;
 
93
        return composite_event_filter(
 
94
            [this]() -> std::shared_ptr<mi::CompositeEventFilter>
 
95
            {
 
96
                auto composite_filter = ServerConfiguration::the_composite_event_filter();
 
97
                for (auto const& filter : filter_list)
 
98
                    composite_filter->append(filter);
 
99
 
 
100
                return composite_filter;
 
101
            });
 
102
    }
 
103
 
 
104
    auto the_window_manager_builder() -> shell::WindowManagerBuilder override
 
105
    {
 
106
        return [&](shell::FocusController* focus_controller)
 
107
            { return std::make_shared<shell::DefaultWindowManager>(
 
108
                focus_controller,
 
109
                the_placement_strategy(),
 
110
                the_session_coordinator()); };
122
111
    }
123
112
 
124
113
    std::shared_ptr<msh::HostLifecycleEventListener> the_host_lifecycle_event_listener() override