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 #include "ui/events/ozone/evdev/keyboard_evdev.h" | 5 #include "ui/events/ozone/evdev/keyboard_evdev.h" |
6 | 6 |
7 #include "ui/events/event.h" | 7 #include "ui/events/event.h" |
8 #include "ui/events/event_constants.h" | 8 #include "ui/events/event_constants.h" |
9 #include "ui/events/keycodes/dom4/keycode_converter.h" | 9 #include "ui/events/keycodes/dom4/keycode_converter.h" |
10 #include "ui/events/ozone/evdev/event_modifiers_evdev.h" | 10 #include "ui/events/ozone/evdev/event_modifiers_evdev.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // State transition: !(down) -> (down) | 77 // State transition: !(down) -> (down) |
78 if (down) | 78 if (down) |
79 key_state_.set(key); | 79 key_state_.set(key); |
80 else | 80 else |
81 key_state_.reset(key); | 81 key_state_.reset(key); |
82 | 82 |
83 UpdateKeyRepeat(key, down); | 83 UpdateKeyRepeat(key, down); |
84 DispatchKey(key, down, false /* repeat */); | 84 DispatchKey(key, down, false /* repeat */); |
85 } | 85 } |
86 | 86 |
| 87 void KeyboardEvdev::SetCapsLockEnabled(bool enabled) { |
| 88 modifiers_->SetModifierLock(EVDEV_MODIFIER_CAPS_LOCK, enabled); |
| 89 } |
| 90 |
| 91 bool KeyboardEvdev::IsCapsLockEnabled() { |
| 92 return (modifiers_->GetModifierFlags() & EF_CAPS_LOCK_DOWN) != 0; |
| 93 } |
| 94 |
87 bool KeyboardEvdev::IsAutoRepeatEnabled() { | 95 bool KeyboardEvdev::IsAutoRepeatEnabled() { |
88 return repeat_enabled_; | 96 return repeat_enabled_; |
89 } | 97 } |
90 | 98 |
91 void KeyboardEvdev::SetAutoRepeatEnabled(bool enabled) { | 99 void KeyboardEvdev::SetAutoRepeatEnabled(bool enabled) { |
92 repeat_enabled_ = enabled; | 100 repeat_enabled_ = enabled; |
93 } | 101 } |
94 | 102 |
95 void KeyboardEvdev::SetAutoRepeatRate(const base::TimeDelta& delay, | 103 void KeyboardEvdev::SetAutoRepeatRate(const base::TimeDelta& delay, |
96 const base::TimeDelta& interval) { | 104 const base::TimeDelta& interval) { |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 } | 198 } |
191 | 199 |
192 // static | 200 // static |
193 int KeyboardEvdev::EvdevCodeToNativeCode(int evdev_code) { | 201 int KeyboardEvdev::EvdevCodeToNativeCode(int evdev_code) { |
194 if (evdev_code == KEY_RESERVED) | 202 if (evdev_code == KEY_RESERVED) |
195 return KeycodeConverter::InvalidNativeKeycode(); | 203 return KeycodeConverter::InvalidNativeKeycode(); |
196 return evdev_code + kXkbKeycodeOffset; | 204 return evdev_code + kXkbKeycodeOffset; |
197 } | 205 } |
198 | 206 |
199 } // namespace ui | 207 } // namespace ui |
OLD | NEW |