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