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 © 2013 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 
20 #ifndef MIR_FRONTEND_SURFACE_H_
21 #define MIR_FRONTEND_SURFACE_H_
22 
24 #include "mir/geometry/point.h"
25 #include "mir/geometry/size.h"
26 #include "mir_toolkit/common.h"
27 
28 #include <memory>
29 
30 namespace mir
31 {
32 namespace graphics
33 {
34 class Buffer;
35 class InternalSurface;
36 }
37 namespace input
38 {
39 class InputChannel;
40 }
41 
42 namespace frontend
43 {
44 
45 class ClientBufferTracker;
46 
47 class Surface
48 {
49 public:
50 
51  virtual ~Surface() {}
52 
53  virtual void force_requests_to_complete() = 0;
54 
55  virtual geometry::Size size() const = 0;
56  virtual geometry::PixelFormat pixel_format() const = 0;
57 
63  virtual std::shared_ptr<graphics::Buffer> advance_client_buffer(bool& need_full_ipc) = 0;
64 
65  virtual bool supports_input() const = 0;
66  virtual int client_input_fd() const = 0;
67 
68  virtual int configure(MirSurfaceAttrib attrib, int value) = 0;
69 
70 protected:
71  Surface() = default;
72  Surface(Surface const&) = delete;
73  Surface& operator=(Surface const&) = delete;
74 };
75 
76 auto as_internal_surface(std::shared_ptr<Surface> const& surface)
77  -> std::shared_ptr<graphics::InternalSurface>;
78 
80 {
81 public:
83  virtual ~ClientTrackingSurface() = default;
84 
85  virtual std::shared_ptr<graphics::Buffer> advance_client_buffer(bool& need_full_ipc) override;
86 
87  virtual std::shared_ptr<graphics::Buffer> advance_client_buffer() = 0;
88 private:
89  std::shared_ptr<ClientBufferTracker> client_tracker;
90 };
91 
92 }
93 }
94 
95 
96 #endif /* MIR_FRONTEND_SURFACE_H_ */

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