namespace
{
char const* const wm_option = "window-manager";
char const* const wm_description = "window management strategy [{tiling|fullscreen|canonical|system-compositor}]";
char const* const wm_tiling = "tiling";
char const* const wm_fullscreen = "fullscreen";
char const* const wm_canonical = "canonical";
char const* const wm_system_compositor = "system-compositor";
struct NullSessionInfo
{
};
struct NullSurfaceInfo
{
NullSurfaceInfo(
std::shared_ptr<ms::Session> const& ,
std::shared_ptr<ms::Surface> const& ,
};
class FullscreenWindowManagerPolicy
{
public:
FullscreenWindowManagerPolicy(Tools* const , std::shared_ptr<msh::DisplayLayout> const& display_layout) :
display_layout{display_layout} {}
void handle_session_info_updated(SessionInfoMap& ,
Rectangles const& ) {}
void handle_displays_updated(SessionInfoMap& ,
Rectangles const& ) {}
auto handle_place_new_surface(
std::shared_ptr<ms::Session> const& ,
{
auto placed_parameters = request_parameters;
display_layout->size_to_output(rect);
placed_parameters.size = rect.size;
return placed_parameters;
}
void handle_modify_surface(
std::shared_ptr<ms::Session> const& ,
std::shared_ptr<ms::Surface> const& ,
{
}
void handle_new_surface(std::shared_ptr<ms::Session> const& , std::shared_ptr<ms::Surface> const& )
{
}
void handle_delete_surface(std::shared_ptr<ms::Session> const& , std::weak_ptr<ms::Surface> const& ) {}
int handle_set_state(std::shared_ptr<ms::Surface>
const& ,
MirSurfaceState value)
{ return value; }
void generate_decorations_for(
std::shared_ptr<ms::Session> const&,
std::shared_ptr<ms::Surface> const&,
SurfaceInfoMap&,
{
}
private:
std::shared_ptr<msh::DisplayLayout> const display_layout;
};
}
{
server.add_configuration_option(wm_option, wm_description, wm_canonical);
-> std::shared_ptr<msh::WindowManager>
{
auto const options = server.get_options();
auto const selection = options->get<
std::string>(wm_option);
if (selection == wm_tiling)
{
return std::make_shared<TilingWindowManager>(focus_controller);
}
else if (selection == wm_fullscreen)
{
return std::make_shared<FullscreenWindowManager>(focus_controller, server.the_shell_display_layout());
}
else if (selection == wm_canonical)
{
return std::make_shared<CanonicalWindowManager>(focus_controller, server.the_shell_display_layout());
}
else if (selection == wm_system_compositor)
{
return std::make_shared<msh::SystemCompositorWindowManager>(
focus_controller,
server.the_shell_display_layout(),
server.the_session_coordinator());
}
});
}