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 
26 #include <string>
27 #include <mutex>
28 
29 struct MirConnection;
30 
31 namespace msh = mir::shell;
32 
33 namespace mir
34 {
35 class ServerActionQueue;
36 namespace frontend
37 {
38 class EventSink;
39 }
40 namespace input
41 {
42 class InputDeviceObserver;
43 class Device;
44 }
45 namespace graphics
46 {
47 namespace nested
48 {
49 
50 using UniqueInputConfig = std::unique_ptr<MirInputConfig, void(*)(MirInputConfig const*)>;
51 
53 {
54 public:
55  MirClientHostConnection(std::string const& host_socket,
56  std::string const& name,
57  std::shared_ptr<msh::HostLifecycleEventListener> const& host_lifecycle_event_listener,
58  std::shared_ptr<frontend::EventSink> const& sink,
59  std::shared_ptr<ServerActionQueue> const& observer_queue);
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  // InputDeviceHub
79  void add_observer(std::shared_ptr<input::InputDeviceObserver> const&) override;
80  void remove_observer(std::weak_ptr<input::InputDeviceObserver> const&) override;
81  void for_each_input_device(std::function<void(input::Device const& device)> const& callback) override;
82 
83 private:
84  void update_input_devices();
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::shared_ptr<frontend::EventSink> const sink;
94  std::shared_ptr<mir::ServerActionQueue> const observer_queue;
95  std::vector<std::shared_ptr<input::InputDeviceObserver>> observers;
96  std::mutex devices_guard;
97  std::vector<std::shared_ptr<input::Device>> devices;
98  UniqueInputConfig config;
99 
100 };
101 
102 }
103 }
104 }
105 
106 #endif /* MIR_GRAPHICS_NESTED_MIR_CLIENT_HOST_CONNECTION_H_ */
All things Mir.
Definition: atomic_callback.h:25
Definition: client_types.h:347
Definition: default_server_configuration.h:69
Definition: mir_client_host_connection.h:52
Definition: input_device_hub.h:32
Definition: host_connection.h:40
Definition: cursor_image.h:30
std::unique_ptr< MirInputConfig, void(*)(MirInputConfig const *)> UniqueInputConfig
Definition: mir_client_host_connection.h:50
unsigned int width
Definition: touchspot_image.c:4
MirBufferUsage
MirBufferUsage specifies how a surface can and will be used.
Definition: client_types.h:156
MirPixelFormat
32-bit pixel formats (8888): The order of components in the enum matches the order of the components ...
Definition: common.h:134
unsigned int height
Definition: touchspot_image.c:5
Definition: mir_connection.h:96
Definition: device.h:37
Definition: platform_operation_message.h:30

Copyright © 2012-2015 Canonical Ltd.
Generated on Wed Mar 30 00:29:56 UTC 2016