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 |
11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
12 #include "base/timer/timer.h" | 12 #include "base/timer/timer.h" |
13 #include "ui/events/ozone/evdev/event_device_util.h" | 13 #include "ui/events/ozone/evdev/event_device_util.h" |
14 #include "ui/events/ozone/evdev/event_dispatch_callback.h" | 14 #include "ui/events/ozone/evdev/event_dispatch_callback.h" |
15 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" | 15 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" |
16 #include "ui/events/ozone/layout/keyboard_layout_engine.h" | 16 #include "ui/events/ozone/layout/keyboard_layout_engine.h" |
17 | 17 |
18 namespace ui { | 18 namespace ui { |
19 | 19 |
20 class EventModifiersEvdev; | 20 class EventModifiersEvdev; |
21 enum class DomCode; | 21 enum class DomCode; |
22 | 22 |
23 // Keyboard for evdev. | 23 // Keyboard for evdev. |
24 // | 24 // |
25 // This object is responsible for combining all attached keyboards into | 25 // This object is responsible for combining all attached keyboards into |
26 // one logical keyboard, applying modifiers & implementing key repeat. | 26 // one logical keyboard, applying modifiers & implementing key repeat. |
27 // | 27 // |
28 // It also currently also applies the layout. | 28 // It also currently also applies the layout. |
29 // | |
30 // TODO(spang): Implement key repeat & turn off kernel repeat. | |
31 class EVENTS_OZONE_EVDEV_EXPORT KeyboardEvdev { | 29 class EVENTS_OZONE_EVDEV_EXPORT KeyboardEvdev { |
32 public: | 30 public: |
33 KeyboardEvdev(EventModifiersEvdev* modifiers, | 31 KeyboardEvdev(EventModifiersEvdev* modifiers, |
34 KeyboardLayoutEngine* keyboard_layout_engine, | 32 KeyboardLayoutEngine* keyboard_layout_engine, |
35 const EventDispatchCallback& callback); | 33 const EventDispatchCallback& callback); |
36 ~KeyboardEvdev(); | 34 ~KeyboardEvdev(); |
37 | 35 |
38 static int NativeCodeToEvdevCode(int native_code); | |
39 static int EvdevCodeToNativeCode(int evdev_code); | |
40 | |
41 // Handlers for raw key presses & releases. | 36 // Handlers for raw key presses & releases. |
42 void OnKeyChange(unsigned int code, bool down); | 37 void OnKeyChange(unsigned int code, bool down); |
43 | 38 |
44 // Configuration for key repeat. | 39 // Configuration for key repeat. |
45 bool IsAutoRepeatEnabled(); | 40 bool IsAutoRepeatEnabled(); |
46 void SetAutoRepeatEnabled(bool enabled); | 41 void SetAutoRepeatEnabled(bool enabled); |
47 void SetAutoRepeatRate(const base::TimeDelta& delay, | 42 void SetAutoRepeatRate(const base::TimeDelta& delay, |
48 const base::TimeDelta& interval); | 43 const base::TimeDelta& interval); |
49 void GetAutoRepeatRate(base::TimeDelta* delay, base::TimeDelta* interval); | 44 void GetAutoRepeatRate(base::TimeDelta* delay, base::TimeDelta* interval); |
50 | 45 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 base::TimeDelta repeat_interval_; | 77 base::TimeDelta repeat_interval_; |
83 base::OneShotTimer<KeyboardEvdev> repeat_delay_timer_; | 78 base::OneShotTimer<KeyboardEvdev> repeat_delay_timer_; |
84 base::RepeatingTimer<KeyboardEvdev> repeat_interval_timer_; | 79 base::RepeatingTimer<KeyboardEvdev> repeat_interval_timer_; |
85 | 80 |
86 DISALLOW_COPY_AND_ASSIGN(KeyboardEvdev); | 81 DISALLOW_COPY_AND_ASSIGN(KeyboardEvdev); |
87 }; | 82 }; |
88 | 83 |
89 } // namespace ui | 84 } // namespace ui |
90 | 85 |
91 #endif // UI_EVENTS_OZONE_EVDEV_KEYBOARD_EVDEV_H_ | 86 #endif // UI_EVENTS_OZONE_EVDEV_KEYBOARD_EVDEV_H_ |
OLD | NEW |