OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_H_ | 5 #ifndef UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_H_ |
6 #define UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_H_ | 6 #define UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 class EVENTS_OZONE_EVDEV_EXPORT EventConverterEvdev | 23 class EVENTS_OZONE_EVDEV_EXPORT EventConverterEvdev |
24 : public base::MessagePumpLibevent::Watcher { | 24 : public base::MessagePumpLibevent::Watcher { |
25 public: | 25 public: |
26 EventConverterEvdev(int fd, | 26 EventConverterEvdev(int fd, |
27 const base::FilePath& path, | 27 const base::FilePath& path, |
28 int id, | 28 int id, |
29 InputDeviceType type); | 29 InputDeviceType type); |
30 ~EventConverterEvdev() override; | 30 ~EventConverterEvdev() override; |
31 | 31 |
32 int id() const { return id_; } | 32 int id() const { return input_device_.id; } |
33 | 33 |
34 const base::FilePath& path() const { return path_; } | 34 const base::FilePath& path() const { return path_; } |
35 | 35 |
36 InputDeviceType type() const { return type_; } | 36 InputDeviceType type() const { return input_device_.type; } |
| 37 |
| 38 const InputDevice& input_device() const { return input_device_; } |
37 | 39 |
38 void set_ignore_events(bool ignore_events) { ignore_events_ = ignore_events; } | 40 void set_ignore_events(bool ignore_events) { ignore_events_ = ignore_events; } |
39 | 41 |
40 // Start reading events. | 42 // Start reading events. |
41 void Start(); | 43 void Start(); |
42 | 44 |
43 // Stop reading events. | 45 // Stop reading events. |
44 void Stop(); | 46 void Stop(); |
45 | 47 |
46 // Cleanup after we stop reading events (release buttons, etc). | 48 // Cleanup after we stop reading events (release buttons, etc). |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 protected: | 86 protected: |
85 // base::MessagePumpLibevent::Watcher: | 87 // base::MessagePumpLibevent::Watcher: |
86 void OnFileCanWriteWithoutBlocking(int fd) override; | 88 void OnFileCanWriteWithoutBlocking(int fd) override; |
87 | 89 |
88 // File descriptor to read. | 90 // File descriptor to read. |
89 int fd_; | 91 int fd_; |
90 | 92 |
91 // Path to input device. | 93 // Path to input device. |
92 base::FilePath path_; | 94 base::FilePath path_; |
93 | 95 |
94 // Uniquely identifies an event converter. | 96 // Input device information, including id (which uniquely identifies an |
95 int id_; | 97 // event converter) and type. |
96 | 98 InputDevice input_device_; |
97 // Type (internal or external). | |
98 InputDeviceType type_; | |
99 | 99 |
100 // Whether events from the device should be ignored. | 100 // Whether events from the device should be ignored. |
101 bool ignore_events_; | 101 bool ignore_events_; |
102 | 102 |
103 // Controller for watching the input fd. | 103 // Controller for watching the input fd. |
104 base::MessagePumpLibevent::FileDescriptorWatcher controller_; | 104 base::MessagePumpLibevent::FileDescriptorWatcher controller_; |
105 | 105 |
106 private: | 106 private: |
107 DISALLOW_COPY_AND_ASSIGN(EventConverterEvdev); | 107 DISALLOW_COPY_AND_ASSIGN(EventConverterEvdev); |
108 }; | 108 }; |
109 | 109 |
110 } // namespace ui | 110 } // namespace ui |
111 | 111 |
112 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_H_ | 112 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_H_ |
OLD | NEW |