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

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: 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
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 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_
OLDNEW
« no previous file with comments | « no previous file | ui/events/ozone/evdev/keyboard_evdev.cc » ('j') | ui/events/ozone/evdev/keyboard_evdev.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698