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 <linux/input.h> | 8 #include <linux/input.h> |
9 | 9 |
10 #include <bitset> | 10 #include <bitset> |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 // Handlers for raw key presses & releases. | 38 // Handlers for raw key presses & releases. |
39 // | 39 // |
40 // |code| is a Linux key code (from <linux/input.h>). |down| represents the | 40 // |code| is a Linux key code (from <linux/input.h>). |down| represents the |
41 // key state. |suppress_auto_repeat| prevents the event from triggering | 41 // key state. |suppress_auto_repeat| prevents the event from triggering |
42 // auto-repeat, if enabled. |device_id| uniquely identifies the source | 42 // auto-repeat, if enabled. |device_id| uniquely identifies the source |
43 // keyboard device. | 43 // keyboard device. |
44 void OnKeyChange(unsigned int code, | 44 void OnKeyChange(unsigned int code, |
45 bool down, | 45 bool down, |
46 bool suppress_auto_repeat, | 46 bool suppress_auto_repeat, |
47 base::TimeDelta timestamp, | 47 base::TimeTicks timestamp, |
48 int device_id); | 48 int device_id); |
49 | 49 |
50 // Handle Caps Lock modifier. | 50 // Handle Caps Lock modifier. |
51 void SetCapsLockEnabled(bool enabled); | 51 void SetCapsLockEnabled(bool enabled); |
52 bool IsCapsLockEnabled(); | 52 bool IsCapsLockEnabled(); |
53 | 53 |
54 // Configuration for key repeat. | 54 // Configuration for key repeat. |
55 bool IsAutoRepeatEnabled(); | 55 bool IsAutoRepeatEnabled(); |
56 void SetAutoRepeatEnabled(bool enabled); | 56 void SetAutoRepeatEnabled(bool enabled); |
57 void SetAutoRepeatRate(const base::TimeDelta& delay, | 57 void SetAutoRepeatRate(const base::TimeDelta& delay, |
(...skipping 12 matching lines...) Expand all Loading... |
70 bool suppress_auto_repeat, | 70 bool suppress_auto_repeat, |
71 int device_id); | 71 int device_id); |
72 void StartKeyRepeat(unsigned int key, int device_id); | 72 void StartKeyRepeat(unsigned int key, int device_id); |
73 void StopKeyRepeat(); | 73 void StopKeyRepeat(); |
74 void ScheduleKeyRepeat(const base::TimeDelta& delay); | 74 void ScheduleKeyRepeat(const base::TimeDelta& delay); |
75 void OnRepeatTimeout(unsigned int sequence); | 75 void OnRepeatTimeout(unsigned int sequence); |
76 void OnRepeatCommit(unsigned int sequence); | 76 void OnRepeatCommit(unsigned int sequence); |
77 void DispatchKey(unsigned int key, | 77 void DispatchKey(unsigned int key, |
78 bool down, | 78 bool down, |
79 bool repeat, | 79 bool repeat, |
80 base::TimeDelta timestamp, | 80 base::TimeTicks timestamp, |
81 int device_id); | 81 int device_id); |
82 | 82 |
83 // Aggregated key state. There is only one bit of state per key; we do not | 83 // Aggregated key state. There is only one bit of state per key; we do not |
84 // attempt to count presses of the same key on multiple keyboards. | 84 // attempt to count presses of the same key on multiple keyboards. |
85 // | 85 // |
86 // A key is down iff the most recent event pertaining to that key was a key | 86 // A key is down iff the most recent event pertaining to that key was a key |
87 // down event rather than a key up event. Therefore, a particular key position | 87 // down event rather than a key up event. Therefore, a particular key position |
88 // can be considered released even if it is being depresssed on one or more | 88 // can be considered released even if it is being depresssed on one or more |
89 // keyboards. | 89 // keyboards. |
90 std::bitset<KEY_CNT> key_state_; | 90 std::bitset<KEY_CNT> key_state_; |
(...skipping 16 matching lines...) Expand all Loading... |
107 base::TimeDelta repeat_interval_; | 107 base::TimeDelta repeat_interval_; |
108 | 108 |
109 base::WeakPtrFactory<KeyboardEvdev> weak_ptr_factory_; | 109 base::WeakPtrFactory<KeyboardEvdev> weak_ptr_factory_; |
110 | 110 |
111 DISALLOW_COPY_AND_ASSIGN(KeyboardEvdev); | 111 DISALLOW_COPY_AND_ASSIGN(KeyboardEvdev); |
112 }; | 112 }; |
113 | 113 |
114 } // namespace ui | 114 } // namespace ui |
115 | 115 |
116 #endif // UI_EVENTS_OZONE_EVDEV_KEYBOARD_EVDEV_H_ | 116 #endif // UI_EVENTS_OZONE_EVDEV_KEYBOARD_EVDEV_H_ |
OLD | NEW |