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 
27 #include <vector>
28 #include <list>
29 
30 namespace mir
31 {
32 namespace input { class InputChannel; }
33 namespace shell { class InputTargeter; }
34 namespace geometry { struct Rectangle; }
35 namespace graphics { class CursorImage; }
36 namespace compositor { class BufferStream; }
37 namespace scene
38 {
39 struct StreamInfo
40 {
41  std::shared_ptr<compositor::BufferStream> stream;
43 };
44 
45 class SurfaceObserver;
46 
47 class Surface :
48  public input::Surface,
49  public frontend::Surface
50 {
51 public:
52  // resolve ambiguous member function names
53 
54  std::string name() const override = 0;
55  geometry::Size client_size() const override = 0;
56  geometry::Rectangle input_bounds() const override = 0;
57 
58  // member functions that don't exist in base classes
59 
61  virtual geometry::Point top_left() const = 0;
63  virtual geometry::Size size() const = 0;
64 
65  virtual graphics::RenderableList generate_renderables(compositor::CompositorID id) const = 0;
66  virtual int buffers_ready_for_compositor(void const* compositor_id) const = 0;
67 
68  virtual float alpha() const = 0; //only used in examples/
69  virtual MirSurfaceType type() const = 0;
70  virtual MirSurfaceState state() const = 0;
71  virtual void hide() = 0;
72  virtual void show() = 0;
73  virtual bool visible() const = 0;
74  virtual void move_to(geometry::Point const& top_left) = 0;
75 
87  virtual void set_input_region(std::vector<geometry::Rectangle> const& region) = 0;
88  virtual void resize(geometry::Size const& size) = 0;
89  virtual void set_transformation(glm::mat4 const& t) = 0;
90  virtual void set_alpha(float alpha) = 0;
91  virtual void set_orientation(MirOrientation orientation) = 0;
92 
93  virtual void set_cursor_image(std::shared_ptr<graphics::CursorImage> const& image) override = 0;
94  virtual std::shared_ptr<graphics::CursorImage> cursor_image() const override = 0;
95 
96  virtual void add_observer(std::shared_ptr<SurfaceObserver> const& observer) = 0;
97  virtual void remove_observer(std::weak_ptr<SurfaceObserver> const& observer) = 0;
98 
99  // TODO input_channel() relates to adding and removing the surface
100  // TODO from the scene and is probably not cleanest interface for this.
101  virtual std::shared_ptr<input::InputChannel> input_channel() const override = 0;
102  virtual void set_reception_mode(input::InputReceptionMode mode) = 0;
103 
104  virtual void request_client_surface_close() = 0;
105  virtual std::shared_ptr<Surface> parent() const = 0;
106 
107  // TODO a legacy of old interactions and needs removing
108  virtual int configure(MirSurfaceAttrib attrib, int value) = 0;
109  // TODO a legacy of old interactions and needs removing
110  virtual int query(MirSurfaceAttrib attrib) const = 0;
111 
112  virtual void set_keymap(MirInputDeviceId id, std::string const& model, std::string const& layout,
113  std::string const& variant, std::string const& options) = 0;
114  virtual void rename(std::string const& title) = 0;
115  virtual void set_streams(std::list<StreamInfo> const& streams) = 0;
116 };
117 }
118 }
119 
120 #endif // MIR_SCENE_SURFACE_H_
std::shared_ptr< compositor::BufferStream > stream
Definition: surface.h:41
Definition: size.h:30
Definition: surface.h:39
All things Mir.
Definition: atomic_callback.h:25
Definition: point.h:30
Definition: surface.h:47
Definition: surface_observer.h:44
MirOrientation
Direction relative to the "natural" orientation of the display.
Definition: common.h:164
MirSurfaceState
Definition: common.h:64
int64_t MirInputDeviceId
Definition: input_event.h:35
MirSurfaceAttrib
Attributes of a surface that the client and server/shell may wish to get or set over the wire...
Definition: common.h:34
MirSurfaceType
Definition: common.h:48
Definition: displacement.h:32
void const * CompositorID
Definition: compositor_id.h:27
std::vector< std::shared_ptr< Renderable > > RenderableList
Definition: renderable.h:79
Definition: rectangle.h:33
Definition: surface.h:45
InputReceptionMode
Definition: input_reception_mode.h:27
Definition: surface.h:47
int const size
Definition: make_socket_rpc_channel.cpp:51
geometry::Displacement displacement
Definition: surface.h:42

Copyright © 2012-2015 Canonical Ltd.
Generated on Wed Mar 30 00:29:56 UTC 2016