| 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_KEYBOARD_EVDEV_H_ | 5 #ifndef UI_EVENTS_OZONE_EVDEV_KEYBOARD_EVDEV_H_ |
| 6 #define UI_EVENTS_OZONE_EVDEV_KEYBOARD_EVDEV_H_ | 6 #define UI_EVENTS_OZONE_EVDEV_KEYBOARD_EVDEV_H_ |
| 7 | 7 |
| 8 #include <bitset> | 8 #include <bitset> |
| 9 #include <linux/input.h> | 9 #include <linux/input.h> |
| 10 | 10 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 void SetAutoRepeatRate(const base::TimeDelta& delay, | 46 void SetAutoRepeatRate(const base::TimeDelta& delay, |
| 47 const base::TimeDelta& interval); | 47 const base::TimeDelta& interval); |
| 48 void GetAutoRepeatRate(base::TimeDelta* delay, base::TimeDelta* interval); | 48 void GetAutoRepeatRate(base::TimeDelta* delay, base::TimeDelta* interval); |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 void UpdateModifier(int modifier_flag, bool down); | 51 void UpdateModifier(int modifier_flag, bool down); |
| 52 void UpdateCapsLockLed(); | 52 void UpdateCapsLockLed(); |
| 53 void UpdateKeyRepeat(unsigned int key, bool down); | 53 void UpdateKeyRepeat(unsigned int key, bool down); |
| 54 void StartKeyRepeat(unsigned int key); | 54 void StartKeyRepeat(unsigned int key); |
| 55 void StopKeyRepeat(); | 55 void StopKeyRepeat(); |
| 56 void OnRepeatDelayTimeout(); | 56 void ScheduleKeyRepeat(const base::TimeDelta& delay); |
| 57 void OnRepeatIntervalTimeout(); | 57 void OnRepeatTimeout(unsigned int sequence); |
| 58 void DispatchKey(unsigned int key, | 58 void DispatchKey(unsigned int key, |
| 59 bool down, | 59 bool down, |
| 60 bool repeat, | 60 bool repeat, |
| 61 base::TimeDelta timestamp); | 61 base::TimeDelta timestamp); |
| 62 | 62 |
| 63 // Aggregated key state. There is only one bit of state per key; we do not | 63 // Aggregated key state. There is only one bit of state per key; we do not |
| 64 // attempt to count presses of the same key on multiple keyboards. | 64 // attempt to count presses of the same key on multiple keyboards. |
| 65 // | 65 // |
| 66 // A key is down iff the most recent event pertaining to that key was a key | 66 // A key is down iff the most recent event pertaining to that key was a key |
| 67 // down event rather than a key up event. Therefore, a particular key position | 67 // down event rather than a key up event. Therefore, a particular key position |
| 68 // can be considered released even if it is being depresssed on one or more | 68 // can be considered released even if it is being depresssed on one or more |
| 69 // keyboards. | 69 // keyboards. |
| 70 std::bitset<KEY_CNT> key_state_; | 70 std::bitset<KEY_CNT> key_state_; |
| 71 | 71 |
| 72 // Callback for dispatching events. | 72 // Callback for dispatching events. |
| 73 EventDispatchCallback callback_; | 73 EventDispatchCallback callback_; |
| 74 | 74 |
| 75 // Shared modifier state. | 75 // Shared modifier state. |
| 76 EventModifiersEvdev* modifiers_; | 76 EventModifiersEvdev* modifiers_; |
| 77 | 77 |
| 78 // Shared layout engine. | 78 // Shared layout engine. |
| 79 KeyboardLayoutEngine* keyboard_layout_engine_; | 79 KeyboardLayoutEngine* keyboard_layout_engine_; |
| 80 | 80 |
| 81 // Key repeat state. | 81 // Key repeat state. |
| 82 bool repeat_enabled_; | 82 bool repeat_enabled_; |
| 83 unsigned int repeat_key_; | 83 unsigned int repeat_key_; |
| 84 unsigned int repeat_sequence_; |
| 84 base::TimeDelta repeat_delay_; | 85 base::TimeDelta repeat_delay_; |
| 85 base::TimeDelta repeat_interval_; | 86 base::TimeDelta repeat_interval_; |
| 86 base::OneShotTimer<KeyboardEvdev> repeat_delay_timer_; | 87 |
| 87 base::RepeatingTimer<KeyboardEvdev> repeat_interval_timer_; | 88 base::WeakPtrFactory<KeyboardEvdev> weak_ptr_factory_; |
| 88 | 89 |
| 89 DISALLOW_COPY_AND_ASSIGN(KeyboardEvdev); | 90 DISALLOW_COPY_AND_ASSIGN(KeyboardEvdev); |
| 90 }; | 91 }; |
| 91 | 92 |
| 92 } // namespace ui | 93 } // namespace ui |
| 93 | 94 |
| 94 #endif // UI_EVENTS_OZONE_EVDEV_KEYBOARD_EVDEV_H_ | 95 #endif // UI_EVENTS_OZONE_EVDEV_KEYBOARD_EVDEV_H_ |
| OLD | NEW |