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" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "ui/events/devices/input_device.h" | 13 #include "ui/events/devices/input_device.h" |
14 #include "ui/events/ozone/evdev/event_dispatch_callback.h" | 14 #include "ui/events/ozone/evdev/event_dispatch_callback.h" |
15 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" | 15 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" |
16 #include "ui/gfx/geometry/size.h" | 16 #include "ui/gfx/geometry/size.h" |
17 | 17 |
18 struct input_event; | 18 struct input_event; |
19 | 19 |
20 namespace ui { | 20 namespace ui { |
21 enum class DomCode; | 21 enum class DomCode; |
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 const std::string& name, | |
31 uint16_t vendor_id, | |
32 uint16_t product_id); | |
33 ~EventConverterEvdev() override; | 30 ~EventConverterEvdev() override; |
34 | 31 |
35 int id() const { return input_device_.id; } | 32 int id() const { return id_; } |
36 | 33 |
37 const base::FilePath& path() const { return path_; } | 34 const base::FilePath& path() const { return path_; } |
38 | 35 |
39 InputDeviceType type() const { return input_device_.type; } | 36 InputDeviceType type() const { return type_; } |
40 | |
41 const InputDevice& input_device() const { return input_device_; } | |
42 | 37 |
43 void set_ignore_events(bool ignore_events) { ignore_events_ = ignore_events; } | 38 void set_ignore_events(bool ignore_events) { ignore_events_ = ignore_events; } |
44 | 39 |
45 // Start reading events. | 40 // Start reading events. |
46 void Start(); | 41 void Start(); |
47 | 42 |
48 // Stop reading events. | 43 // Stop reading events. |
49 void Stop(); | 44 void Stop(); |
50 | 45 |
51 // Cleanup after we stop reading events (release buttons, etc). | 46 // Cleanup after we stop reading events (release buttons, etc). |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 protected: | 84 protected: |
90 // base::MessagePumpLibevent::Watcher: | 85 // base::MessagePumpLibevent::Watcher: |
91 void OnFileCanWriteWithoutBlocking(int fd) override; | 86 void OnFileCanWriteWithoutBlocking(int fd) override; |
92 | 87 |
93 // File descriptor to read. | 88 // File descriptor to read. |
94 int fd_; | 89 int fd_; |
95 | 90 |
96 // Path to input device. | 91 // Path to input device. |
97 base::FilePath path_; | 92 base::FilePath path_; |
98 | 93 |
99 // Input device information, including id (which uniquely identifies an | 94 // Uniquely identifies an event converter. |
100 // event converter) and type. | 95 int id_; |
101 InputDevice input_device_; | 96 |
| 97 // Type (internal or external). |
| 98 InputDeviceType type_; |
102 | 99 |
103 // Whether events from the device should be ignored. | 100 // Whether events from the device should be ignored. |
104 bool ignore_events_; | 101 bool ignore_events_; |
105 | 102 |
106 // Controller for watching the input fd. | 103 // Controller for watching the input fd. |
107 base::MessagePumpLibevent::FileDescriptorWatcher controller_; | 104 base::MessagePumpLibevent::FileDescriptorWatcher controller_; |
108 | 105 |
109 private: | 106 private: |
110 DISALLOW_COPY_AND_ASSIGN(EventConverterEvdev); | 107 DISALLOW_COPY_AND_ASSIGN(EventConverterEvdev); |
111 }; | 108 }; |
112 | 109 |
113 } // namespace ui | 110 } // namespace ui |
114 | 111 |
115 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_H_ | 112 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_H_ |
OLD | NEW |