| 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_IMPL_H_ | 5 #ifndef UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_IMPL_H_ |
| 6 #define UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_IMPL_H_ | 6 #define UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_IMPL_H_ |
| 7 | 7 |
| 8 #include <bitset> | 8 #include <bitset> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/message_loop/message_pump_libevent.h" | 12 #include "base/message_loop/message_pump_libevent.h" |
| 13 #include "ui/events/devices/input_device.h" | 13 #include "ui/events/devices/input_device.h" |
| 14 #include "ui/events/event.h" | 14 #include "ui/events/event.h" |
| 15 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" | 15 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" |
| 16 #include "ui/events/ozone/evdev/event_converter_evdev.h" | 16 #include "ui/events/ozone/evdev/event_converter_evdev.h" |
| 17 #include "ui/events/ozone/evdev/event_device_info.h" | 17 #include "ui/events/ozone/evdev/event_device_info.h" |
| 18 #include "ui/events/ozone/evdev/event_modifiers_evdev.h" | 18 #include "ui/events/ozone/evdev/event_modifiers_evdev.h" |
| 19 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" | 19 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" |
| 20 #include "ui/events/ozone/evdev/keyboard_evdev.h" | 20 #include "ui/events/ozone/evdev/keyboard_evdev.h" |
| 21 #include "ui/events/ozone/evdev/mouse_button_map_evdev.h" | 21 #include "ui/events/ozone/evdev/mouse_button_map_evdev.h" |
| 22 #include "ui/events/ozone/evdev/scoped_input_device.h" |
| 22 | 23 |
| 23 struct input_event; | 24 struct input_event; |
| 24 | 25 |
| 25 namespace ui { | 26 namespace ui { |
| 26 | 27 |
| 27 class DeviceEventDispatcherEvdev; | 28 class DeviceEventDispatcherEvdev; |
| 28 | 29 |
| 29 class EVENTS_OZONE_EVDEV_EXPORT EventConverterEvdevImpl | 30 class EVENTS_OZONE_EVDEV_EXPORT EventConverterEvdevImpl |
| 30 : public EventConverterEvdev { | 31 : public EventConverterEvdev { |
| 31 public: | 32 public: |
| 32 EventConverterEvdevImpl(int fd, | 33 EventConverterEvdevImpl(ScopedInputDevice fd, |
| 33 base::FilePath path, | 34 base::FilePath path, |
| 34 int id, | 35 int id, |
| 35 const EventDeviceInfo& info, | 36 const EventDeviceInfo& info, |
| 36 CursorDelegateEvdev* cursor, | 37 CursorDelegateEvdev* cursor, |
| 37 DeviceEventDispatcherEvdev* dispatcher); | 38 DeviceEventDispatcherEvdev* dispatcher); |
| 38 ~EventConverterEvdevImpl() override; | 39 ~EventConverterEvdevImpl() override; |
| 39 | 40 |
| 40 // EventConverterEvdev: | 41 // EventConverterEvdev: |
| 41 void OnFileCanReadWithoutBlocking(int fd) override; | 42 void OnFileCanReadWithoutBlocking(int fd) override; |
| 42 bool HasKeyboard() const override; | 43 bool HasKeyboard() const override; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 57 void ReleaseKeys(); | 58 void ReleaseKeys(); |
| 58 void ReleaseMouseButtons(); | 59 void ReleaseMouseButtons(); |
| 59 void OnLostSync(); | 60 void OnLostSync(); |
| 60 void DispatchMouseButton(const input_event& input); | 61 void DispatchMouseButton(const input_event& input); |
| 61 void OnButtonChange(int code, bool down, base::TimeTicks timestamp); | 62 void OnButtonChange(int code, bool down, base::TimeTicks timestamp); |
| 62 | 63 |
| 63 // Flush events delimited by EV_SYN. This is useful for handling | 64 // Flush events delimited by EV_SYN. This is useful for handling |
| 64 // non-axis-aligned movement properly. | 65 // non-axis-aligned movement properly. |
| 65 void FlushEvents(const input_event& input); | 66 void FlushEvents(const input_event& input); |
| 66 | 67 |
| 68 // Input device file descriptor. |
| 69 ScopedInputDevice input_device_fd_; |
| 70 |
| 67 // Input modalities for this device. | 71 // Input modalities for this device. |
| 68 bool has_keyboard_; | 72 bool has_keyboard_; |
| 69 bool has_touchpad_; | 73 bool has_touchpad_; |
| 70 | 74 |
| 71 // LEDs for this device. | 75 // LEDs for this device. |
| 72 bool has_caps_lock_led_; | 76 bool has_caps_lock_led_; |
| 73 | 77 |
| 74 // Save x-axis events of relative devices to be flushed at EV_SYN time. | 78 // Save x-axis events of relative devices to be flushed at EV_SYN time. |
| 75 int x_offset_ = 0; | 79 int x_offset_ = 0; |
| 76 | 80 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 96 // Callbacks for dispatching events. | 100 // Callbacks for dispatching events. |
| 97 DeviceEventDispatcherEvdev* dispatcher_; | 101 DeviceEventDispatcherEvdev* dispatcher_; |
| 98 | 102 |
| 99 DISALLOW_COPY_AND_ASSIGN(EventConverterEvdevImpl); | 103 DISALLOW_COPY_AND_ASSIGN(EventConverterEvdevImpl); |
| 100 }; | 104 }; |
| 101 | 105 |
| 102 } // namespace ui | 106 } // namespace ui |
| 103 | 107 |
| 104 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_IMPL_H_ | 108 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_IMPL_H_ |
| 105 | 109 |
| OLD | NEW |