Mir
platform.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2015 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU Lesser 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 Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Andreas Pokorny <andreas.pokorny@canonical.com>
17  */
18 
19 #ifndef MIR_INPUT_EVDEV_PLATFORM_H_
20 #define MIR_INPUT_EVDEV_PLATFORM_H_
21 
22 #include "libinput_ptr.h"
23 #include "libinput_device_ptr.h"
24 
25 #include "mir/input/platform.h"
26 
27 #include <vector>
28 
29 struct libinput_device_group;
30 struct libinput_device;
31 
32 namespace mir
33 {
34 namespace udev
35 {
36 class Device;
37 class Monitor;
38 class Context;
39 }
40 namespace dispatch
41 {
42 class MultiplexingDispatchable;
43 class ReadableFd;
44 }
45 namespace input
46 {
47 class InputDeviceRegistry;
48 namespace evdev
49 {
50 
51 struct MonitorDispatchable;
52 class LibInputDevice;
53 
54 class Platform : public input::Platform
55 {
56 public:
57  Platform(std::shared_ptr<InputDeviceRegistry> const& registry,
58  std::shared_ptr<InputReport> const& report,
59  std::unique_ptr<udev::Context>&& udev_context);
60  std::shared_ptr<mir::dispatch::Dispatchable> dispatchable() override;
61  void start() override;
62  void stop() override;
63 
64 private:
65  void scan_for_devices();
66  void device_added(libinput_device* dev);
67  void device_removed(libinput_device* dev);
68  void process_input_events();
69 
70  std::shared_ptr<LibInputDevice> create_device(udev::Device const& dev) const;
71 
72  std::shared_ptr<InputReport> const report;
73  std::shared_ptr<udev::Context> const udev_context;
74  std::shared_ptr<InputDeviceRegistry> const input_device_registry;
75  std::shared_ptr<dispatch::MultiplexingDispatchable> const platform_dispatchable;
76  std::shared_ptr<::libinput> lib;
77  std::shared_ptr<dispatch::ReadableFd> libinput_dispatchable;
78 
79  std::vector<std::shared_ptr<LibInputDevice>> devices;
80  auto find_device(libinput_device_group const* group) -> decltype(devices)::iterator;
81 };
82 }
83 }
84 }
85 
86 #endif
All things Mir.
Definition: atomic_callback.h:25
Input Platform is used to discover and access available input devices.
Definition: platform.h:65
Definition: wrapper.h:50
std::promise< bool > stop
Definition: in.cpp:28
Definition: platform.h:54

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