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> | 8 #include <set> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 DeviceEventDispatcherEvdev* dispatcher); | 37 DeviceEventDispatcherEvdev* dispatcher); |
38 ~EventConverterEvdevImpl() override; | 38 ~EventConverterEvdevImpl() override; |
39 | 39 |
40 // EventConverterEvdev: | 40 // EventConverterEvdev: |
41 void OnFileCanReadWithoutBlocking(int fd) override; | 41 void OnFileCanReadWithoutBlocking(int fd) override; |
42 bool HasKeyboard() const override; | 42 bool HasKeyboard() const override; |
43 bool HasTouchpad() const override; | 43 bool HasTouchpad() const override; |
44 bool HasCapsLockLed() const override; | 44 bool HasCapsLockLed() const override; |
45 void SetAllowedKeys(scoped_ptr<std::set<DomCode>> allowed_keys) override; | 45 void SetAllowedKeys(scoped_ptr<std::set<DomCode>> allowed_keys) override; |
46 void AllowAllKeys() override; | 46 void AllowAllKeys() override; |
| 47 void OnStopped() override; |
47 | 48 |
48 void ProcessEvents(const struct input_event* inputs, int count); | 49 void ProcessEvents(const struct input_event* inputs, int count); |
49 | 50 |
50 private: | 51 private: |
51 void ConvertKeyEvent(const input_event& input); | 52 void ConvertKeyEvent(const input_event& input); |
52 | |
53 void ConvertMouseMoveEvent(const input_event& input); | 53 void ConvertMouseMoveEvent(const input_event& input); |
54 | 54 void OnKeyChange(unsigned int key, |
| 55 bool down, |
| 56 const base::TimeDelta& timestamp); |
| 57 void ReleaseKeys(); |
| 58 void OnLostSync(); |
55 void DispatchMouseButton(const input_event& input); | 59 void DispatchMouseButton(const input_event& input); |
56 | 60 |
57 // Flush events delimited by EV_SYN. This is useful for handling | 61 // Flush events delimited by EV_SYN. This is useful for handling |
58 // non-axis-aligned movement properly. | 62 // non-axis-aligned movement properly. |
59 void FlushEvents(const input_event& input); | 63 void FlushEvents(const input_event& input); |
60 | 64 |
61 // Input modalities for this device. | 65 // Input modalities for this device. |
62 bool has_keyboard_; | 66 bool has_keyboard_; |
63 bool has_touchpad_; | 67 bool has_touchpad_; |
64 | 68 |
65 // LEDs for this device. | 69 // LEDs for this device. |
66 bool has_caps_lock_led_; | 70 bool has_caps_lock_led_; |
67 | 71 |
68 // Save x-axis events of relative devices to be flushed at EV_SYN time. | 72 // Save x-axis events of relative devices to be flushed at EV_SYN time. |
69 int x_offset_; | 73 int x_offset_; |
70 | 74 |
71 // Save y-axis events of relative devices to be flushed at EV_SYN time. | 75 // Save y-axis events of relative devices to be flushed at EV_SYN time. |
72 int y_offset_; | 76 int y_offset_; |
73 | 77 |
74 // Controller for watching the input fd. | 78 // Controller for watching the input fd. |
75 base::MessagePumpLibevent::FileDescriptorWatcher controller_; | 79 base::MessagePumpLibevent::FileDescriptorWatcher controller_; |
76 | 80 |
77 // The keys which should be processed. nullptr if all keys should be | 81 // The keys which should be processed. nullptr if all keys should be |
78 // processed. | 82 // processed. |
79 scoped_ptr<std::set<DomCode>> allowed_keys_; | 83 scoped_ptr<std::set<DomCode>> allowed_keys_; |
80 | 84 |
| 85 // Pressed keys bitset. |
| 86 std::bitset<KEY_CNT> key_state_; |
| 87 |
81 // Shared cursor state. | 88 // Shared cursor state. |
82 CursorDelegateEvdev* cursor_; | 89 CursorDelegateEvdev* cursor_; |
83 | 90 |
84 // Callbacks for dispatching events. | 91 // Callbacks for dispatching events. |
85 DeviceEventDispatcherEvdev* dispatcher_; | 92 DeviceEventDispatcherEvdev* dispatcher_; |
86 | 93 |
87 DISALLOW_COPY_AND_ASSIGN(EventConverterEvdevImpl); | 94 DISALLOW_COPY_AND_ASSIGN(EventConverterEvdevImpl); |
88 }; | 95 }; |
89 | 96 |
90 } // namespace ui | 97 } // namespace ui |
91 | 98 |
92 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_IMPL_H_ | 99 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_IMPL_H_ |
93 | 100 |
OLD | NEW |