Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
surface_stack.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2012-2014 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 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: Alan Griffiths <alan@octopull.co.uk>
17  */
18 
19 #ifndef MIR_SCENE_SCENETACK_H_
20 #define MIR_SCENE_SCENETACK_H_
21 
22 #include "surface_stack_model.h"
23 
24 #include "mir/compositor/scene.h"
25 #include "mir/scene/depth_id.h"
27 
28 #include <memory>
29 #include <vector>
30 #include <mutex>
31 #include <map>
32 
33 namespace mir
34 {
35 namespace compositor
36 {
37 class FilterForScene;
38 class OperatorForScene;
39 }
40 
41 namespace frontend
42 {
43 struct SurfaceCreationParameters;
44 }
45 
46 namespace input
47 {
48 class InputChannelFactory;
49 class InputChannel;
50 }
51 
54 namespace scene
55 {
56 class InputRegistrar;
57 class BasicSurface;
58 class SceneReport;
59 
61 {
62 public:
63  explicit SurfaceStack(
64  std::shared_ptr<InputRegistrar> const& input_registrar,
65  std::shared_ptr<SceneReport> const& report);
66  virtual ~SurfaceStack() noexcept(true) {}
67 
68  // From Scene
70  virtual void set_change_callback(std::function<void()> const& f);
71  //to be deprecated
73  virtual void lock();
74  virtual void unlock();
75  //end to be deprecated
76 
77  // From InputTargets
78  void for_each(std::function<void(std::shared_ptr<input::InputChannel> const&)> const& callback);
79 
80  virtual void remove_surface(std::weak_ptr<Surface> const& surface) override;
81 
82  virtual void raise(std::weak_ptr<Surface> const& surface) override;
83 
84  void add_surface(
85  std::shared_ptr<Surface> const& surface,
86  DepthId depth,
87  input::InputReceptionMode input_mode) override;
88 
89 private:
90  SurfaceStack(const SurfaceStack&) = delete;
91  SurfaceStack& operator=(const SurfaceStack&) = delete;
92 
93  void emit_change_notification();
94 
95  std::recursive_mutex mutable guard;
96  std::shared_ptr<InputRegistrar> const input_registrar;
97  std::shared_ptr<SceneReport> const report;
98  std::function<void()> const change_cb;
99 
100  typedef std::vector<std::shared_ptr<Surface>> Layer;
101  std::map<DepthId, Layer> layers_by_depth;
102 
103  std::mutex notify_change_mutex;
104  std::function<void()> notify_change;
105 };
106 
107 }
108 }
109 
110 #endif /* MIR_SCENE_SCENETACK_H_ */
Definition: surface_stack_model.h:41
virtual void remove_surface(std::weak_ptr< Surface > const &surface) override
Definition: surface_stack.h:60
Definition: scene.h:34
Definition: scene.h:61
void for_each(std::function< void(std::shared_ptr< input::InputChannel > const &)> const &callback)
true
Definition: display_configuration.cpp:30
std::list< std::shared_ptr< Renderable > > RenderableList
Definition: renderable.h:88
virtual ~SurfaceStack() noexcept(true)
Definition: surface_stack.h:66
graphics::RenderableList generate_renderable_list() const
Generate a valid list of renderables based on the current state of the Scene.
virtual void for_each_if(compositor::FilterForScene &filter, compositor::OperatorForScene &op)
Definition: input_targets.h:33
void add_surface(std::shared_ptr< Surface > const &surface, DepthId depth, input::InputReceptionMode input_mode) override
Definition: scene.h:47
InputReceptionMode
Definition: input_reception_mode.h:27
SurfaceStack(std::shared_ptr< InputRegistrar > const &input_registrar, std::shared_ptr< SceneReport > const &report)
Definition: surface_stack.cpp:50
virtual void set_change_callback(std::function< void()> const &f)
Sets a callback to be called whenever the state of the Scene changes.

Copyright © 2012,2013 Canonical Ltd.
Generated on Fri Apr 11 21:14:53 UTC 2014