Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
surface.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2012 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: Thomas Voss <thomas.voss@canonical.com>
17  */
18 
19 #ifndef MIR_SURFACES_SURFACE_H_
20 #define MIR_SURFACES_SURFACE_H_
21 
23 #include "mir/geometry/rectangle.h"
25 
26 #include <glm/glm.hpp>
27 #include <vector>
28 #include <memory>
29 #include <string>
30 
31 namespace mir
32 {
33 namespace compositor
34 {
35 class CompositingCriteria;
36 struct BufferIPCPackage;
37 }
38 namespace graphics
39 {
40 class Buffer;
41 }
42 namespace input
43 {
44 class InputChannel;
45 class Surface;
46 }
47 namespace surfaces
48 {
49 class SurfaceState;
50 class BufferStream;
51 
52 // TODO this is ideally an implementation class. It is only in a public header
53 // TODO because it is used in some example code (which probably needs rethinking).
54 class Surface
55 {
56 public:
57  Surface(std::shared_ptr<surfaces::SurfaceState> const& surface_state,
58  std::shared_ptr<BufferStream> const& buffer_stream,
59  std::shared_ptr<input::InputChannel> const& input_channel);
60 
61  ~Surface();
62 
63  std::string const& name() const;
64  void move_to(geometry::Point const& top_left);
65  void set_rotation(float degrees, glm::vec3 const& axis);
66  void set_alpha(float alpha);
67  void set_hidden(bool is_hidden);
68 
69  /* From Renderable */
70  geometry::Point top_left() const;
71  geometry::Size size() const;
72 
74 
75  std::shared_ptr<graphics::Buffer> snapshot_buffer() const;
76  std::shared_ptr<graphics::Buffer> advance_client_buffer();
78  void flag_for_render();
79 
80  bool supports_input() const;
81  int client_input_fd() const;
82  void allow_framedropping(bool);
83  std::shared_ptr<input::InputChannel> input_channel() const;
84 
85  void set_input_region(std::vector<geometry::Rectangle> const& input_rectangles);
86 
87  std::shared_ptr<compositor::CompositingCriteria> compositing_criteria();
88 
89  std::shared_ptr<BufferStream> buffer_stream() const;
90 
91  std::shared_ptr<input::Surface> input_surface() const;
92 private:
93  std::shared_ptr<surfaces::SurfaceState> surface_state;
94  std::shared_ptr<BufferStream> surface_buffer_stream;
95  std::shared_ptr<input::InputChannel> const server_input_channel;
96  bool surface_in_startup;
97 };
98 
99 }
100 }
101 
102 #endif // MIR_SURFACES_SURFACE_H_

Copyright © 2012,2013 Canonical Ltd.
Generated on Wed Oct 30 18:52:19 UTC 2013