| 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 DispatchKeyRepeat(unsigned int key); |
| 58 void DispatchKey(unsigned int key, | 59 void DispatchKey(unsigned int key, |
| 59 bool down, | 60 bool down, |
| 60 bool repeat, | 61 bool repeat, |
| 61 base::TimeDelta timestamp); | 62 base::TimeDelta timestamp); |
| 62 | 63 |
| 63 // Aggregated key state. There is only one bit of state per key; we do not | 64 // 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. | 65 // attempt to count presses of the same key on multiple keyboards. |
| 65 // | 66 // |
| 66 // A key is down iff the most recent event pertaining to that key was a key | 67 // 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 | 68 // 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 | 69 // can be considered released even if it is being depresssed on one or more |
| 69 // keyboards. | 70 // keyboards. |
| 70 std::bitset<KEY_CNT> key_state_; | 71 std::bitset<KEY_CNT> key_state_; |
| 71 | 72 |
| 72 // Callback for dispatching events. | 73 // Callback for dispatching events. |
| 73 EventDispatchCallback callback_; | 74 EventDispatchCallback callback_; |
| 74 | 75 |
| 75 // Shared modifier state. | 76 // Shared modifier state. |
| 76 EventModifiersEvdev* modifiers_; | 77 EventModifiersEvdev* modifiers_; |
| 77 | 78 |
| 78 // Shared layout engine. | 79 // Shared layout engine. |
| 79 KeyboardLayoutEngine* keyboard_layout_engine_; | 80 KeyboardLayoutEngine* keyboard_layout_engine_; |
| 80 | 81 |
| 81 // Key repeat state. | 82 // Key repeat state. |
| 82 bool repeat_enabled_; | 83 bool repeat_enabled_; |
| 83 unsigned int repeat_key_; | 84 unsigned int repeat_key_; |
| 85 unsigned int repeat_sequence_; |
| 84 base::TimeDelta repeat_delay_; | 86 base::TimeDelta repeat_delay_; |
| 85 base::TimeDelta repeat_interval_; | 87 base::TimeDelta repeat_interval_; |
| 86 base::OneShotTimer<KeyboardEvdev> repeat_delay_timer_; | 88 |
| 87 base::RepeatingTimer<KeyboardEvdev> repeat_interval_timer_; | 89 base::WeakPtrFactory<KeyboardEvdev> weak_ptr_factory_; |
| 88 | 90 |
| 89 DISALLOW_COPY_AND_ASSIGN(KeyboardEvdev); | 91 DISALLOW_COPY_AND_ASSIGN(KeyboardEvdev); |
| 90 }; | 92 }; |
| 91 | 93 |
| 92 } // namespace ui | 94 } // namespace ui |
| 93 | 95 |
| 94 #endif // UI_EVENTS_OZONE_EVDEV_KEYBOARD_EVDEV_H_ | 96 #endif // UI_EVENTS_OZONE_EVDEV_KEYBOARD_EVDEV_H_ |
| OLD | NEW |