Mir
input_platform.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2016 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:
17  * Andreas Pokorny <andreas.pokorny@canonical.com>
18  */
19 
20 #ifndef MIR_GRAPHICS_NESTED_INPUT_PLATFORM_H_
21 #define MIR_GRAPHICS_NESTED_INPUT_PLATFORM_H_
22 
23 #include "host_connection.h"
24 #include "mir/input/platform.h"
27 
28 #include <memory>
29 #include <unordered_map>
30 #include <mutex>
31 
32 namespace mir
33 {
34 namespace input
35 {
36 class InputDevice;
37 class InputDeviceRegistry;
38 class InputReport;
39 }
40 namespace graphics
41 {
42 namespace nested
43 {
44 class HostConnection;
46 {
47 public:
48  InputPlatform(std::shared_ptr<HostConnection> const& connection,
49  std::shared_ptr<input::InputDeviceRegistry> const& input_device_registry,
50  std::shared_ptr<input::InputReport> const& report);
51  std::shared_ptr<mir::dispatch::Dispatchable> dispatchable() override;
52  void start() override;
53  void stop() override;
54 
55 private:
56  void update_devices();
57  void update_devices_locked();
58  struct InputDevice;
59  std::shared_ptr<HostConnection> const connection;
60  std::shared_ptr<input::InputDeviceRegistry> const input_device_registry;
61  std::shared_ptr<input::InputReport> const report;
62  std::shared_ptr<dispatch::ActionQueue> const action_queue;
63  std::mutex devices_guard;
64  UniqueInputConfig input_config;
65 
66  using EventUPtr = std::unique_ptr<MirEvent, void(*)(MirEvent*)>;
67  std::unordered_map<MirInputDeviceId, std::shared_ptr<InputDevice>> devices;
68  std::unordered_map<MirInputDeviceId, std::vector<std::pair<EventUPtr, mir::geometry::Rectangle>>>
69  unknown_device_events;
70 };
71 }
72 }
73 }
74 
75 #endif
All things Mir.
Definition: atomic_callback.h:25
Input Platform is used to discover and access available input devices.
Definition: platform.h:65
std::unique_ptr< MirInputConfig, void(*)(MirInputConfig const *)> UniqueInputConfig
Definition: host_connection.h:40
std::promise< bool > stop
Definition: in.cpp:28
Definition: input_platform.h:45

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