Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
demo_shell.cpp

A simple mir shell

/*
* Copyright © 2013 Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Authored by: Robert Carr <robert.carr@canonical.com>
*/
#include "window_manager.h"
#include "../server_configuration.h"
#include "mir/run_mir.h"
#include <iostream>
namespace me = mir::examples;
namespace msh = mir::shell;
namespace mg = mir::graphics;
namespace mf = mir::frontend;
namespace mi = mir::input;
namespace mir
{
namespace examples
{
struct DemoServerConfiguration : mir::examples::ServerConfiguration
{
DemoServerConfiguration(int argc, char const* argv[],
std::initializer_list<std::shared_ptr<mi::EventFilter>> const& filter_list)
: ServerConfiguration(argc, argv),
{
namespace po = boost::program_options;
("fullscreen-surfaces", po::value<bool>(),
"Make all surfaces fullscreen [bool:default=false]");
}
std::shared_ptr<msh::PlacementStrategy> the_shell_placement_strategy() override
{
[this]() -> std::shared_ptr<msh::PlacementStrategy>
{
if (the_options()->is_set("fullscreen-surfaces"))
return std::make_shared<me::FullscreenPlacementStrategy>(the_shell_display_layout());
else
});
}
std::shared_ptr<mi::CompositeEventFilter> the_composite_event_filter() override
{
for (auto const& filter : filter_list)
composite_filter->append(filter);
return composite_filter;
}
std::vector<std::shared_ptr<mi::EventFilter>> const filter_list;
};
}
}
int main(int argc, char const* argv[])
try
{
auto wm = std::make_shared<me::WindowManager>();
me::DemoServerConfiguration config(argc, argv, {wm});
mir::run_mir(config, [&config, &wm](mir::DisplayServer&)
{
// We use this strange two stage initialization to avoid a circular dependency between the EventFilters
// and the SessionStore
wm->set_focus_controller(config.the_focus_controller());
wm->set_session_manager(config.the_session_manager());
wm->set_display(config.the_display());
wm->set_compositor(config.the_compositor());
});
return 0;
}
catch (...)
{
return 1;
}

Copyright © 2012,2013 Canonical Ltd.
Generated on Wed Oct 30 18:52:19 UTC 2013