Mir
mir_client_host_connection.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: Alexandros Frantzis <alexandros.frantzis@canonical.com>
17  */
18 
19 #ifndef MIR_GRAPHICS_NESTED_MIR_CLIENT_HOST_CONNECTION_H_
20 #define MIR_GRAPHICS_NESTED_MIR_CLIENT_HOST_CONNECTION_H_
21 
22 #include "host_connection.h"
25 #include "mir/geometry/size.h"
28 
29 #include <string>
30 #include <vector>
31 #include <mutex>
32 
33 struct MirConnection;
34 
35 namespace msh = mir::shell;
36 
37 namespace mir
38 {
39 class ServerActionQueue;
40 namespace frontend
41 {
42 class EventSink;
43 }
44 namespace input
45 {
46 class InputDeviceObserver;
47 class Device;
48 }
49 namespace graphics
50 {
51 namespace nested
52 {
53 
55 {
56 public:
57  MirClientHostConnection(std::string const& host_socket,
58  std::string const& name,
59  std::shared_ptr<msh::HostLifecycleEventListener> const& host_lifecycle_event_listener);
61 
62  std::vector<int> platform_fd_items() override;
63  EGLNativeDisplayType egl_native_display() override;
64  std::shared_ptr<MirDisplayConfiguration> create_display_config() override;
65  std::shared_ptr<HostSurface> create_surface(
66  int width, int height, MirPixelFormat pf, char const* name,
67  MirBufferUsage usage, uint32_t output_id) override;
68  void set_display_config_change_callback(std::function<void()> const& cb) override;
69  void apply_display_config(MirDisplayConfiguration&) override;
70 
71  void set_cursor_image(CursorImage const& image) override;
72  void hide_cursor() override;
73  auto graphics_platform_library() -> std::string override;
74 
75  virtual PlatformOperationMessage platform_operation(
76  unsigned int op, PlatformOperationMessage const& request) override;
77 
78  UniqueInputConfig create_input_device_config() override;
79  void set_input_device_change_callback(std::function<void(UniqueInputConfig)> const& cb) override;
80  void set_input_event_callback(std::function<void(MirEvent const&, mir::geometry::Rectangle const&)> const& cb) override;
81  void emit_input_event(MirEvent const& cb, mir::geometry::Rectangle const& source_frame) override;
82 
83 private:
84  void update_input_config(UniqueInputConfig input_config);
85  std::mutex surfaces_mutex;
86 
87  MirConnection* const mir_connection;
88  std::function<void()> conf_change_callback;
89  std::shared_ptr<msh::HostLifecycleEventListener> const host_lifecycle_event_listener;
90 
91  std::vector<HostSurface*> surfaces;
92 
93  std::function<void(UniqueInputConfig)> input_config_callback;
94  std::function<void(MirEvent const&, mir::geometry::Rectangle const&)> event_callback;
95 
96  struct NestedCursorImage : graphics::CursorImage
97  {
98  NestedCursorImage() = default;
99  NestedCursorImage(graphics::CursorImage const& other);
100  NestedCursorImage& operator=(graphics::CursorImage const& other);
101 
102  void const* as_argb_8888() const override;
103  geometry::Size size() const override;
104  geometry::Displacement hotspot() const override;
105  private:
106  geometry::Displacement hotspot_;
107  geometry::Size size_;
108  std::vector<uint8_t> buffer;
109  };
110  NestedCursorImage stored_cursor_image;
111 };
112 
113 }
114 }
115 }
116 
117 #endif /* MIR_GRAPHICS_NESTED_MIR_CLIENT_HOST_CONNECTION_H_ */
Definition: size.h:30
All things Mir.
Definition: atomic_callback.h:25
Definition: client_types.h:353
Definition: default_server_configuration.h:69
Definition: mir_client_host_connection.h:54
Definition: host_connection.h:43
Definition: cursor_image.h:30
std::unique_ptr< MirInputConfig, void(*)(MirInputConfig const *)> UniqueInputConfig
Definition: host_connection.h:40
unsigned int width
Definition: touchspot_image.c:4
MirBufferUsage
MirBufferUsage specifies how a surface can and will be used.
Definition: client_types.h:159
MirPixelFormat
32-bit pixel formats (8888): The order of components in the enum matches the order of the components ...
Definition: common.h:134
Definition: displacement.h:32
Definition: rectangle.h:33
unsigned int height
Definition: touchspot_image.c:5
Definition: mir_connection.h:96
Definition: platform_operation_message.h:30
int const size
Definition: make_socket_rpc_channel.cpp:51
Definition: event.h:30

Copyright © 2012-2015 Canonical Ltd.
Generated on Thu Sep 8 14:50:19 UTC 2016