Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Side by Side Diff: ui/events/ozone/evdev/keyboard_evdev.h

Issue 1052273006: ozone: evdev: Make cancellation of repeats on key up more robust (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge DispatchKeyRepeat Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ui/events/ozone/evdev/keyboard_evdev.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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_
OLDNEW
« no previous file with comments | « no previous file | ui/events/ozone/evdev/keyboard_evdev.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698