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 "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/message_loop/message_pump_libevent.h" | 9 #include "base/message_loop/message_pump_libevent.h" |
10 #include "ui/events/devices/input_device.h" | 10 #include "ui/events/devices/input_device.h" |
11 #include "ui/events/event.h" | 11 #include "ui/events/event.h" |
12 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" | 12 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" |
13 #include "ui/events/ozone/evdev/event_converter_evdev.h" | 13 #include "ui/events/ozone/evdev/event_converter_evdev.h" |
| 14 #include "ui/events/ozone/evdev/event_device_info.h" |
14 #include "ui/events/ozone/evdev/event_modifiers_evdev.h" | 15 #include "ui/events/ozone/evdev/event_modifiers_evdev.h" |
15 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" | 16 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" |
16 #include "ui/events/ozone/evdev/keyboard_evdev.h" | 17 #include "ui/events/ozone/evdev/keyboard_evdev.h" |
17 #include "ui/events/ozone/evdev/mouse_button_map_evdev.h" | 18 #include "ui/events/ozone/evdev/mouse_button_map_evdev.h" |
18 | 19 |
19 struct input_event; | 20 struct input_event; |
20 | 21 |
21 namespace ui { | 22 namespace ui { |
22 | 23 |
23 class EVENTS_OZONE_EVDEV_EXPORT EventConverterEvdevImpl | 24 class EVENTS_OZONE_EVDEV_EXPORT EventConverterEvdevImpl |
24 : public EventConverterEvdev { | 25 : public EventConverterEvdev { |
25 public: | 26 public: |
26 EventConverterEvdevImpl(int fd, | 27 EventConverterEvdevImpl(int fd, |
27 base::FilePath path, | 28 base::FilePath path, |
28 int id, | 29 int id, |
29 InputDeviceType type, | 30 InputDeviceType type, |
| 31 const EventDeviceInfo& info, |
30 EventModifiersEvdev* modifiers, | 32 EventModifiersEvdev* modifiers, |
31 MouseButtonMapEvdev* button_map, | 33 MouseButtonMapEvdev* button_map, |
32 CursorDelegateEvdev* cursor, | 34 CursorDelegateEvdev* cursor, |
33 KeyboardEvdev* keyboard, | 35 KeyboardEvdev* keyboard, |
34 const EventDispatchCallback& callback); | 36 const EventDispatchCallback& callback); |
35 ~EventConverterEvdevImpl() override; | 37 ~EventConverterEvdevImpl() override; |
36 | 38 |
37 // EventConverterEvdev: | 39 // EventConverterEvdev: |
38 void OnFileCanReadWithoutBlocking(int fd) override; | 40 void OnFileCanReadWithoutBlocking(int fd) override; |
| 41 bool HasKeyboard() const override; |
39 | 42 |
40 void ProcessEvents(const struct input_event* inputs, int count); | 43 void ProcessEvents(const struct input_event* inputs, int count); |
41 | 44 |
42 private: | 45 private: |
43 void ConvertKeyEvent(const input_event& input); | 46 void ConvertKeyEvent(const input_event& input); |
44 | 47 |
45 void ConvertMouseMoveEvent(const input_event& input); | 48 void ConvertMouseMoveEvent(const input_event& input); |
46 | 49 |
47 void DispatchMouseButton(const input_event& input); | 50 void DispatchMouseButton(const input_event& input); |
48 | 51 |
49 // Flush events delimited by EV_SYN. This is useful for handling | 52 // Flush events delimited by EV_SYN. This is useful for handling |
50 // non-axis-aligned movement properly. | 53 // non-axis-aligned movement properly. |
51 void FlushEvents(); | 54 void FlushEvents(); |
52 | 55 |
| 56 // Input modalities for this device. |
| 57 bool has_keyboard_; |
| 58 |
53 // Save x-axis events of relative devices to be flushed at EV_SYN time. | 59 // Save x-axis events of relative devices to be flushed at EV_SYN time. |
54 int x_offset_; | 60 int x_offset_; |
55 | 61 |
56 // Save y-axis events of relative devices to be flushed at EV_SYN time. | 62 // Save y-axis events of relative devices to be flushed at EV_SYN time. |
57 int y_offset_; | 63 int y_offset_; |
58 | 64 |
59 // Controller for watching the input fd. | 65 // Controller for watching the input fd. |
60 base::MessagePumpLibevent::FileDescriptorWatcher controller_; | 66 base::MessagePumpLibevent::FileDescriptorWatcher controller_; |
61 | 67 |
62 // Shared cursor state. | 68 // Shared cursor state. |
(...skipping 11 matching lines...) Expand all Loading... |
74 // Callback for dispatching events. | 80 // Callback for dispatching events. |
75 EventDispatchCallback callback_; | 81 EventDispatchCallback callback_; |
76 | 82 |
77 DISALLOW_COPY_AND_ASSIGN(EventConverterEvdevImpl); | 83 DISALLOW_COPY_AND_ASSIGN(EventConverterEvdevImpl); |
78 }; | 84 }; |
79 | 85 |
80 } // namespace ui | 86 } // namespace ui |
81 | 87 |
82 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_IMPL_H_ | 88 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_IMPL_H_ |
83 | 89 |
OLD | NEW |