Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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"
25 #include "mir/frontend/surface.h"
26 
27 #include <vector>
28 
29 namespace mir
30 {
31 namespace input { class InputChannel; }
32 namespace shell { class InputTargeter; }
33 namespace geometry { class Rectangle; }
34 namespace graphics { class CursorImage; }
35 
36 namespace scene
37 {
38 class SurfaceObserver;
39 
40 class Surface :
41  public input::Surface,
42  public frontend::Surface,
43  public SurfaceBufferAccess
44 {
45 public:
46  // resolve ambiguous member function names
47 
48  std::string name() const override = 0;
49  geometry::Size client_size() const override = 0;
50  geometry::Rectangle input_bounds() const override = 0;
51 
52  // member functions that don't exist in base classes
53 
55  virtual geometry::Point top_left() const = 0;
57  virtual geometry::Size size() const = 0;
58 
59  virtual std::unique_ptr<graphics::Renderable> compositor_snapshot(void const* compositor_id) const = 0;
60 
61  virtual float alpha() const = 0; //only used in examples/
62  virtual MirSurfaceType type() const = 0;
63  virtual MirSurfaceState state() const = 0;
64  virtual void hide() = 0;
65  virtual void show() = 0;
66  virtual void move_to(geometry::Point const& top_left) = 0;
67  virtual void take_input_focus(std::shared_ptr<shell::InputTargeter> const& targeter) = 0;
68 
80  virtual void set_input_region(std::vector<geometry::Rectangle> const& region) = 0;
81  virtual void allow_framedropping(bool) = 0;
82  virtual void resize(geometry::Size const& size) = 0;
83  virtual void set_transformation(glm::mat4 const& t) = 0;
84  virtual void set_alpha(float alpha) = 0;
85  virtual void set_orientation(MirOrientation orientation) = 0;
86  virtual void force_requests_to_complete() = 0;
87 
88  virtual void set_cursor_image(std::shared_ptr<graphics::CursorImage> const& image) = 0;
89  virtual std::shared_ptr<graphics::CursorImage> cursor_image() const = 0;
90 
91  virtual void add_observer(std::shared_ptr<SurfaceObserver> const& observer) = 0;
92  virtual void remove_observer(std::weak_ptr<SurfaceObserver> const& observer) = 0;
93 
94  // TODO input_channel() relates to adding and removing the surface
95  // TODO from the scene and is probably not cleanest interface for this.
96  virtual std::shared_ptr<input::InputChannel> input_channel() const = 0;
97  virtual void set_reception_mode(input::InputReceptionMode mode) = 0;
98 };
99 }
100 }
101 
102 #endif // MIR_SCENE_SURFACE_H_
Definition: size.h:30
virtual MirSurfaceType type() const =0
All things Mir.
Definition: aging_buffer.h:24
virtual void set_cursor_image(std::shared_ptr< graphics::CursorImage > const &image)=0
virtual void set_transformation(glm::mat4 const &t)=0
virtual void resize(geometry::Size const &size)=0
virtual std::shared_ptr< input::InputChannel > input_channel() const =0
Definition: point.h:30
Definition: surface.h:47
geometry::Size client_size() const override=0
Size of the client area of the surface (excluding any decorations)
virtual void add_observer(std::shared_ptr< SurfaceObserver > const &observer)=0
geometry::Rectangle input_bounds() const override=0
virtual void allow_framedropping(bool)=0
MirOrientation
Direction relative to the "natural" orientation of the display.
Definition: common.h:134
virtual void set_reception_mode(input::InputReceptionMode mode)=0
MirSurfaceState
Definition: common.h:61
virtual void set_orientation(MirOrientation orientation)=0
Definition: surface_buffer_access.h:33
virtual float alpha() const =0
virtual void show()=0
virtual void force_requests_to_complete()=0
virtual std::shared_ptr< graphics::CursorImage > cursor_image() const =0
virtual void set_alpha(float alpha)=0
std::string name() const override=0
virtual void remove_observer(std::weak_ptr< SurfaceObserver > const &observer)=0
MirSurfaceType
Definition: common.h:49
virtual void set_input_region(std::vector< geometry::Rectangle > const &region)=0
Sets the input region for this surface.
virtual std::unique_ptr< graphics::Renderable > compositor_snapshot(void const *compositor_id) const =0
Definition: rectangle.h:33
virtual MirSurfaceState state() const =0
Definition: surface.h:41
InputReceptionMode
Definition: input_reception_mode.h:27
Definition: surface.h:40
virtual geometry::Size size() const =0
Size of the surface including window frame (if any)
virtual geometry::Point top_left() const =0
Top-left corner (of the window frame if present)
virtual void hide()=0
virtual void move_to(geometry::Point const &top_left)=0
virtual void take_input_focus(std::shared_ptr< shell::InputTargeter > const &targeter)=0

Copyright © 2012,2013 Canonical Ltd.
Generated on Fri Oct 10 14:07:14 UTC 2014