2
* Copyright © 2013-2014 Canonical Ltd.
2
* Copyright © 2013-2015 Canonical Ltd.
4
4
* This program is free software: you can redistribute it and/or modify
5
5
* it under the terms of the GNU General Public License version 3 as
21
21
#define MIR_INCLUDE_DEPRECATED_EVENT_HEADER
23
#include "mir/shell/surface_coordinator_wrapper.h"
23
#include "mir/shell/shell_wrapper.h"
24
24
#include "mir/scene/surface_creation_parameters.h"
25
25
#include "mir/scene/surface.h"
26
26
#include "mir/scene/session.h"
144
145
using ClientInputRegions = std::map<std::string, std::vector<geom::Rectangle>>;
146
struct RegionApplyingSurfaceCoordinator : msh::SurfaceCoordinatorWrapper
147
struct RegionApplyingShell : msh::ShellWrapper
148
RegionApplyingSurfaceCoordinator(
149
std::shared_ptr<ms::SurfaceCoordinator> wrapped_coordinator,
150
std::shared_ptr<msh::Shell> wrapped_coordinator,
150
151
ClientInputRegions const& client_input_regions)
151
: msh::SurfaceCoordinatorWrapper(wrapped_coordinator),
152
: msh::ShellWrapper(wrapped_coordinator),
152
153
client_input_regions(client_input_regions)
156
std::shared_ptr<ms::Surface> add_surface(
157
ms::SurfaceCreationParameters const& params,
158
ms::Session* session) override
157
mf::SurfaceId create_surface(
158
std::shared_ptr<ms::Session> const& session,
159
ms::SurfaceCreationParameters const& params) override
160
auto const surface = wrapped->add_surface(params, session);
161
auto const id = wrapped->create_surface(session, params);
163
auto const surface = session->surface(id);
162
165
if (client_input_regions.find(params.name) != client_input_regions.end())
163
166
surface->set_input_region(client_input_regions.at(params.name));
168
171
ClientInputRegions const& client_input_regions;
183
186
client_geometries, client_depths);
186
std::shared_ptr<ms::SurfaceCoordinator>
187
wrap_surface_coordinator(std::shared_ptr<ms::SurfaceCoordinator> const& wrapped) override
189
std::shared_ptr<msh::Shell>
190
wrap_shell(std::shared_ptr<msh::Shell> const& wrapped) override
189
return std::make_shared<RegionApplyingSurfaceCoordinator>(
192
return std::make_shared<RegionApplyingShell>(
191
194
client_input_regions);