Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends 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 
23 #include "mir/geometry/point.h"
24 #include "mir/geometry/size.h"
25 #include "mir_toolkit/common.h"
26 
27 #include <glm/glm.hpp>
28 
29 #include <memory>
30 
31 namespace mir
32 {
33 namespace graphics
34 {
35 class Buffer;
36 class InternalSurface;
37 }
38 namespace input
39 {
40 class InputChannel;
41 }
42 
43 namespace frontend
44 {
45 
46 class ClientBufferTracker;
47 
48 class Surface
49 {
50 public:
51 
52  virtual ~Surface() {}
53 
54  virtual void force_requests_to_complete() = 0;
55 
56  virtual geometry::Size size() const = 0;
57  virtual MirPixelFormat pixel_format() const = 0;
58 
59  virtual void swap_buffers(graphics::Buffer* old_buffer, std::function<void(graphics::Buffer* new_buffer)> complete) = 0;
60 
61  virtual bool supports_input() const = 0;
62  virtual int client_input_fd() const = 0;
63 
64  virtual int configure(MirSurfaceAttrib attrib, int value) = 0;
65 
72 
73 protected:
74  Surface() = default;
75  Surface(Surface const&) = delete;
76  Surface& operator=(Surface const&) = delete;
77 };
78 
79 auto as_internal_surface(std::shared_ptr<Surface> const& surface)
80  -> std::shared_ptr<graphics::InternalSurface>;
81 }
82 }
83 
84 
85 #endif /* MIR_FRONTEND_SURFACE_H_ */
Definition: size.h:30
auto as_internal_surface(std::shared_ptr< Surface > const &surface) -> std::shared_ptr< graphics::InternalSurface >
Definition: surface.cpp:35
Surface & operator=(Surface const &)=delete
virtual int configure(MirSurfaceAttrib attrib, int value)=0
virtual void force_requests_to_complete()=0
virtual void swap_buffers(graphics::Buffer *old_buffer, std::function< void(graphics::Buffer *new_buffer)> complete)=0
virtual MirPixelFormat pixel_format() const =0
virtual ~Surface()
Definition: surface.h:52
virtual geometry::Size size() const =0
MirSurfaceAttrib
Attributes of a surface that the client and server/shell may wish to get or set over the wire...
Definition: common.h:34
virtual int client_input_fd() const =0
void swap_buffers_blocking(graphics::Buffer *&buffer)
swap_buffers_blocking() is a convenience wrapper around swap_buffers() it forces the current thread t...
Definition: surface.cpp:57
MirPixelFormat
The order of components in a format enum matches the order of the components as they would be written...
Definition: common.h:99
Definition: surface.h:48
Definition: buffer.h:34
virtual bool supports_input() const =0

Copyright © 2012,2013 Canonical Ltd.
Generated on Fri Apr 11 21:14:53 UTC 2014