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 <set> |
| 9 |
8 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
9 #include "base/message_loop/message_pump_libevent.h" | 11 #include "base/message_loop/message_pump_libevent.h" |
10 #include "ui/events/devices/input_device.h" | 12 #include "ui/events/devices/input_device.h" |
11 #include "ui/events/event.h" | 13 #include "ui/events/event.h" |
12 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" | 14 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" |
13 #include "ui/events/ozone/evdev/event_converter_evdev.h" | 15 #include "ui/events/ozone/evdev/event_converter_evdev.h" |
14 #include "ui/events/ozone/evdev/event_device_info.h" | 16 #include "ui/events/ozone/evdev/event_device_info.h" |
15 #include "ui/events/ozone/evdev/event_modifiers_evdev.h" | 17 #include "ui/events/ozone/evdev/event_modifiers_evdev.h" |
16 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" | 18 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" |
17 #include "ui/events/ozone/evdev/keyboard_evdev.h" | 19 #include "ui/events/ozone/evdev/keyboard_evdev.h" |
(...skipping 14 matching lines...) Expand all Loading... |
32 EventModifiersEvdev* modifiers, | 34 EventModifiersEvdev* modifiers, |
33 MouseButtonMapEvdev* button_map, | 35 MouseButtonMapEvdev* button_map, |
34 CursorDelegateEvdev* cursor, | 36 CursorDelegateEvdev* cursor, |
35 KeyboardEvdev* keyboard, | 37 KeyboardEvdev* keyboard, |
36 const EventDispatchCallback& callback); | 38 const EventDispatchCallback& callback); |
37 ~EventConverterEvdevImpl() override; | 39 ~EventConverterEvdevImpl() override; |
38 | 40 |
39 // EventConverterEvdev: | 41 // EventConverterEvdev: |
40 void OnFileCanReadWithoutBlocking(int fd) override; | 42 void OnFileCanReadWithoutBlocking(int fd) override; |
41 bool HasKeyboard() const override; | 43 bool HasKeyboard() const override; |
| 44 bool HasTouchpad() const override; |
| 45 void SetAllowedKeys(scoped_ptr<std::set<DomCode>> allowed_keys) override; |
| 46 void AllowAllKeys() override; |
42 | 47 |
43 void ProcessEvents(const struct input_event* inputs, int count); | 48 void ProcessEvents(const struct input_event* inputs, int count); |
44 | 49 |
45 private: | 50 private: |
46 void ConvertKeyEvent(const input_event& input); | 51 void ConvertKeyEvent(const input_event& input); |
47 | 52 |
48 void ConvertMouseMoveEvent(const input_event& input); | 53 void ConvertMouseMoveEvent(const input_event& input); |
49 | 54 |
50 void DispatchMouseButton(const input_event& input); | 55 void DispatchMouseButton(const input_event& input); |
51 | 56 |
52 // Flush events delimited by EV_SYN. This is useful for handling | 57 // Flush events delimited by EV_SYN. This is useful for handling |
53 // non-axis-aligned movement properly. | 58 // non-axis-aligned movement properly. |
54 void FlushEvents(); | 59 void FlushEvents(); |
55 | 60 |
56 // Input modalities for this device. | 61 // Input modalities for this device. |
57 bool has_keyboard_; | 62 bool has_keyboard_; |
| 63 bool has_touchpad_; |
58 | 64 |
59 // Save x-axis events of relative devices to be flushed at EV_SYN time. | 65 // Save x-axis events of relative devices to be flushed at EV_SYN time. |
60 int x_offset_; | 66 int x_offset_; |
61 | 67 |
62 // Save y-axis events of relative devices to be flushed at EV_SYN time. | 68 // Save y-axis events of relative devices to be flushed at EV_SYN time. |
63 int y_offset_; | 69 int y_offset_; |
64 | 70 |
65 // Controller for watching the input fd. | 71 // Controller for watching the input fd. |
66 base::MessagePumpLibevent::FileDescriptorWatcher controller_; | 72 base::MessagePumpLibevent::FileDescriptorWatcher controller_; |
67 | 73 |
| 74 // The keys which should be processed. nullptr if all keys should be |
| 75 // processed. |
| 76 scoped_ptr<std::set<DomCode>> allowed_keys_; |
| 77 |
68 // Shared cursor state. | 78 // Shared cursor state. |
69 CursorDelegateEvdev* cursor_; | 79 CursorDelegateEvdev* cursor_; |
70 | 80 |
71 // Shared keyboard state. | 81 // Shared keyboard state. |
72 KeyboardEvdev* keyboard_; | 82 KeyboardEvdev* keyboard_; |
73 | 83 |
74 // Modifier key state (shift, ctrl, etc). | 84 // Modifier key state (shift, ctrl, etc). |
75 EventModifiersEvdev* modifiers_; | 85 EventModifiersEvdev* modifiers_; |
76 | 86 |
77 // Shared mouse button map. | 87 // Shared mouse button map. |
78 MouseButtonMapEvdev* button_map_; | 88 MouseButtonMapEvdev* button_map_; |
79 | 89 |
80 // Callback for dispatching events. | 90 // Callback for dispatching events. |
81 EventDispatchCallback callback_; | 91 EventDispatchCallback callback_; |
82 | 92 |
83 DISALLOW_COPY_AND_ASSIGN(EventConverterEvdevImpl); | 93 DISALLOW_COPY_AND_ASSIGN(EventConverterEvdevImpl); |
84 }; | 94 }; |
85 | 95 |
86 } // namespace ui | 96 } // namespace ui |
87 | 97 |
88 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_IMPL_H_ | 98 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_IMPL_H_ |
89 | 99 |
OLD | NEW |