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