Mir
input_devices.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_INPUT_DEVICES_H_
20 #define MIR_INPUT_INPUT_DEVICES_H_
21 
24 
25 #include <vector>
26 #include <mutex>
27 #include <string>
28 
29 namespace mir
30 {
31 namespace input
32 {
33 struct DeviceData
34 {
35  DeviceData() = default;
37  : id(id), caps(caps), name(name), unique_id(unique_id)
38  {
39  }
41  uint32_t caps;
44 };
45 
47 {
48 public:
49  InputDevices() = default;
50  void update_devices(std::vector<DeviceData> && data);
51  std::vector<DeviceData> copy_devices();
52  void set_change_callback(std::function<void()> const& callback);
53 private:
54  std::mutex devices_access;
55  std::vector<DeviceData> devices;
56  std::function<void()> callback;
57 };
58 
59 }
60 }
61 
62 #endif
All things Mir.
Definition: atomic_callback.h:25
MirInputDeviceId id
Definition: input_devices.h:40
std::string name
Definition: input_devices.h:42
DeviceData(MirInputDeviceId id, uint32_t caps, std::string const &name, std::string const &unique_id)
Definition: input_devices.h:36
int64_t MirInputDeviceId
Definition: input_event.h:35
Definition: input_devices.h:33
std::string unique_id
Definition: input_devices.h:43
Definition: input_devices.h:46
uint32_t caps
Definition: input_devices.h:41

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