Mir
session.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: Robert Carr <racarr@canonical.com>
17  */
18 
19 #ifndef MIR_FRONTEND_SESSION_H_
20 #define MIR_FRONTEND_SESSION_H_
21 
22 #include "mir_toolkit/common.h"
24 #include "mir/graphics/buffer_id.h"
25 #include "mir/geometry/size.h"
27 
28 #include <memory>
29 #include <string>
30 
31 class MirInputConfig;
32 
33 namespace mir
34 {
35 class ClientVisibleError;
36 
37 namespace graphics
38 {
39 class DisplayConfiguration;
40 struct BufferProperties;
41 class Buffer;
42 }
43 
44 namespace frontend
45 {
46 class Surface;
47 class BufferStream;
48 
49 class Session
50 {
51 public:
52  virtual ~Session() = default;
53 
54  virtual std::shared_ptr<Surface> get_surface(SurfaceId surface) const = 0;
55 
56  virtual std::shared_ptr<BufferStream> get_buffer_stream(BufferStreamId stream) const = 0;
57  virtual BufferStreamId create_buffer_stream(graphics::BufferProperties const& props) = 0;
58  virtual void destroy_buffer_stream(BufferStreamId stream) = 0;
59 
60  virtual graphics::BufferID create_buffer(graphics::BufferProperties const& properties) = 0;
61  virtual void destroy_buffer(graphics::BufferID) = 0;
62  virtual std::shared_ptr<graphics::Buffer> get_buffer(graphics::BufferID) = 0;
63 
64  virtual std::string name() const = 0;
65 
66  virtual void send_display_config(graphics::DisplayConfiguration const&) = 0;
67  virtual void send_error(ClientVisibleError const&) = 0;
68  virtual void send_input_config(MirInputConfig const& config) = 0;
69 
70 protected:
71  Session() = default;
72  Session(Session const&) = delete;
73  Session& operator=(Session const&) = delete;
74 };
75 
77 {
78 public:
79  virtual ~SessionExtensions() = default;
80  virtual graphics::BufferID create_buffer(geometry::Size, MirPixelFormat) = 0;
81  virtual graphics::BufferID create_buffer(geometry::Size, uint32_t native_format, uint32_t native_flags) = 0;
82 protected:
83  SessionExtensions() = default;
84  SessionExtensions(SessionExtensions const&) = delete;
85  SessionExtensions& operator=(SessionExtensions const&) = delete;
86 
87 };
88 
89 }
90 }
91 
92 #endif // MIR_FRONTEND_SESSION_H_
Definition: size.h:30
Definition: session.h:49
Definition: as_render_target.h:27
MirPixelFormat
32-bit pixel formats (8888): The order of components in the enum matches the order of the components ...
Definition: common.h:241
Definition: session.h:76
char const * name
Definition: client_types.h:170
Buffer creation properties.
Definition: buffer_properties.h:48
Definition: mir_input_config.h:77
Interface to a configuration of display cards and outputs.
Definition: display_configuration.h:185

Copyright © 2012-2016 Canonical Ltd.
Generated on Mon Jun 5 11:07:25 UTC 2017