Mir
placement_applying_shell.h
Go to the documentation of this file.
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 2 or 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: Andreas Pokorny <andreas.pokorny@canonical.com>
17  */
18 
19 #ifndef MIR_TEST_FRAMEWORK_PLACEMENT_APPLYING_SHELL_H_
20 #define MIR_TEST_FRAMEWORK_PLACEMENT_APPLYING_SHELL_H_
21 
22 #include "mir/shell/shell_wrapper.h"
23 #include "mir/geometry/rectangle.h"
24 
25 #include "mir/scene/session.h"
26 #include "mir/scene/surface.h"
27 #include "mir/scene/surface_creation_parameters.h"
28 
29 #include <vector>
30 #include <string>
31 #include <map>
32 #include <mutex>
33 #include <condition_variable>
34 
35 namespace mir_test_framework
36 {
37 using ClientInputRegions = std::map<std::string, std::vector<mir::geometry::Rectangle>>;
38 using ClientPositions = std::map<std::string, mir::geometry::Rectangle>;
39 
40 struct PlacementApplyingShell : mir::shell::ShellWrapper
41 {
43  std::shared_ptr<mir::shell::Shell> wrapped_coordinator,
44  ClientInputRegions const& client_input_regions,
45  ClientPositions const& client_positions);
46 
49  std::shared_ptr<mir::scene::Session> const& session,
50  mir::scene::SurfaceCreationParameters const& params,
51  std::shared_ptr<mir::frontend::EventSink> const& sink) override;
52 
53  void modify_surface(
54  std::shared_ptr<mir::scene::Session> const& session,
55  std::shared_ptr<mir::scene::Surface> const& surface,
56  mir::shell::SurfaceSpecification const& modifications) override;
57 
58  bool wait_for_modify_surface(std::chrono::seconds timeout);
59 
60  std::weak_ptr <mir::scene::Surface> latest_surface;
61 
62 private:
63  ClientInputRegions const& client_input_regions;
64  ClientPositions const& client_positions;
65  std::mutex mutex;
66  std::condition_variable cv;
67  bool modified {false};
68 };
69 
70 }
71 
72 #endif
PlacementApplyingShell(std::shared_ptr< mir::shell::Shell > wrapped_coordinator, ClientInputRegions const &client_input_regions, ClientPositions const &client_positions)
std::map< std::string, mir::geometry::Rectangle > ClientPositions
Definition: placement_applying_shell.h:38
std::map< std::string, std::vector< mir::geometry::Rectangle > > ClientInputRegions
Definition: placement_applying_shell.h:37
mir::frontend::SurfaceId create_surface(std::shared_ptr< mir::scene::Session > const &session, mir::scene::SurfaceCreationParameters const &params, std::shared_ptr< mir::frontend::EventSink > const &sink) override
Definition: int_wrapper.h:27
bool wait_for_modify_surface(std::chrono::seconds timeout)
Definition: any_surface.h:25
Definition: placement_applying_shell.h:40
std::weak_ptr< mir::scene::Surface > latest_surface
Definition: placement_applying_shell.h:60
void modify_surface(std::shared_ptr< mir::scene::Session > const &session, std::shared_ptr< mir::scene::Surface > const &surface, mir::shell::SurfaceSpecification const &modifications) override

Copyright © 2012-2018 Canonical Ltd.
Generated on Sun Jun 17 06:26:29 UTC 2018