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  virtual std::shared_ptr<graphics::CursorImage> cursor_image() const override = 0;
97 
98  virtual void add_observer(std::shared_ptr<SurfaceObserver> const& observer) = 0;
99  virtual void remove_observer(std::weak_ptr<SurfaceObserver> const& observer) = 0;
100 
101  // TODO input_channel() relates to adding and removing the surface
102  // TODO from the scene and is probably not cleanest interface for this.
103  virtual std::shared_ptr<input::InputChannel> input_channel() const override = 0;
104  virtual void set_reception_mode(input::InputReceptionMode mode) = 0;
105 
106  virtual void request_client_surface_close() = 0;
107  virtual std::shared_ptr<Surface> parent() const = 0;
108 
109  // TODO a legacy of old interactions and needs removing
110  virtual int configure(MirWindowAttrib attrib, int value) = 0;
111  // TODO a legacy of old interactions and needs removing
112  virtual int query(MirWindowAttrib attrib) const = 0;
113 
114  virtual void set_keymap(MirInputDeviceId id, std::string const& model, std::string const& layout,
115  std::string const& variant, std::string const& options) = 0;
116  virtual void rename(std::string const& title) = 0;
117  virtual void set_streams(std::list<StreamInfo> const& streams) = 0;
118 
119  virtual void set_confine_pointer_state(MirPointerConfinementState state) = 0;
120  virtual MirPointerConfinementState confine_pointer_state() const = 0;
121 
122  virtual void placed_relative(geometry::Rectangle const& placement) = 0;
123 };
124 }
125 }
126 
127 #endif // MIR_SCENE_SURFACE_H_
std::shared_ptr< compositor::BufferStream > stream
Definition: surface.h:42
Definition: size.h:30
Definition: surface.h:40
Definition: as_render_target.h:27
Definition: point.h:30
MirWindowAttrib
Attributes of a window that the client and server/shell may wish to get or set over the wire...
Definition: common.h:76
Definition: surface.h:47
MirPointerConfinementState
Pointer Confinement.
Definition: common.h:446
Definition: surface_observer.h:45
MirOrientation
Direction relative to the "natural" orientation of the display.
Definition: common.h:271
optional_value< geometry::Size > size
Definition: surface.h:44
int64_t MirInputDeviceId
Definition: mir_input_device_types.h:31
MirWindowType
Definition: common.h:109
Definition: displacement.h:32
void const * CompositorID
Definition: compositor_id.h:27
std::vector< std::shared_ptr< Renderable > > RenderableList
Definition: renderable.h:80
Definition: rectangle.h:33
Definition: surface.h:45
char const * name
Definition: client_types.h:170
MirWindowState
Definition: common.h:139
InputReceptionMode
Definition: input_reception_mode.h:27
Definition: surface.h:49
geometry::Displacement displacement
Definition: surface.h:43

Copyright © 2012-2016 Canonical Ltd.
Generated on Fri Dec 20 06:52:43 UTC 2019