Mir
surface.h
Go to the documentation of this file.
1 /*
2  * Copyright © 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_SURFACE_H_
20 #define MIR_SCENE_SURFACE_H_
21 
23 #include "mir/input/surface.h"
24 #include "mir/frontend/surface.h"
26 #include "mir/optional_value.h"
27 
28 #include <vector>
29 #include <list>
30 
31 namespace mir
32 {
33 namespace input { class InputChannel; }
34 namespace shell { class InputTargeter; }
35 namespace geometry { struct Rectangle; }
36 namespace graphics { class CursorImage; }
37 namespace compositor { class BufferStream; }
38 namespace scene
39 {
40 struct StreamInfo
41 {
42  std::shared_ptr<compositor::BufferStream> stream;
45 };
46 
47 class SurfaceObserver;
48 
49 class Surface :
50  public input::Surface,
51  public frontend::Surface
52 {
53 public:
54  // resolve ambiguous member function names
55 
56  std::string name() const override = 0;
57  geometry::Size client_size() const override = 0;
58  geometry::Rectangle input_bounds() const override = 0;
59 
60  // member functions that don't exist in base classes
61 
63  virtual geometry::Point top_left() const = 0;
65  virtual geometry::Size size() const = 0;
66 
67  virtual graphics::RenderableList generate_renderables(compositor::CompositorID id) const = 0;
68  virtual int buffers_ready_for_compositor(void const* compositor_id) const = 0;
69 
70  virtual float alpha() const = 0; //only used in examples/
71  virtual MirWindowType type() const = 0;
72  virtual MirWindowState state() const = 0;
73  virtual void hide() = 0;
74  virtual void show() = 0;
75  virtual bool visible() const = 0;
76  virtual void move_to(geometry::Point const& top_left) = 0;
77 
89  virtual void set_input_region(std::vector<geometry::Rectangle> const& region) = 0;
90  virtual void resize(geometry::Size const& size) = 0;
91  virtual void set_transformation(glm::mat4 const& t) = 0;
92  virtual void set_alpha(float alpha) = 0;
93  virtual void set_orientation(MirOrientation orientation) = 0;
94 
95  virtual void set_cursor_image(std::shared_ptr<graphics::CursorImage> const& image) override = 0;
96