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/event_utils.h" | 9 #include "ui/events/event_utils.h" |
10 #include "ui/events/keycodes/dom4/keycode_converter.h" | 10 #include "ui/events/keycodes/dom4/keycode_converter.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 // State transition: !(down) -> (down) | 75 // State transition: !(down) -> (down) |
76 if (down) | 76 if (down) |
77 key_state_.set(key); | 77 key_state_.set(key); |
78 else | 78 else |
79 key_state_.reset(key); | 79 key_state_.reset(key); |
80 | 80 |
81 UpdateKeyRepeat(key, down); | 81 UpdateKeyRepeat(key, down); |
82 DispatchKey(key, down, false /* repeat */, timestamp); | 82 DispatchKey(key, down, false /* repeat */, timestamp); |
83 } | 83 } |
84 | 84 |
85 void KeyboardEvdev::Reset() { | |
86 for (int key = 0; key < KEY_CNT; ++key) | |
87 OnKeyChange(key, false /* down */, ui::EventTimeForNow()); | |
88 } | |
89 | |
90 void KeyboardEvdev::SetCapsLockEnabled(bool enabled) { | 85 void KeyboardEvdev::SetCapsLockEnabled(bool enabled) { |
91 modifiers_->SetModifierLock(EVDEV_MODIFIER_CAPS_LOCK, enabled); | 86 modifiers_->SetModifierLock(EVDEV_MODIFIER_CAPS_LOCK, enabled); |
92 } | 87 } |
93 | 88 |
94 bool KeyboardEvdev::IsCapsLockEnabled() { | 89 bool KeyboardEvdev::IsCapsLockEnabled() { |
95 return (modifiers_->GetModifierFlags() & EF_CAPS_LOCK_DOWN) != 0; | 90 return (modifiers_->GetModifierFlags() & EF_CAPS_LOCK_DOWN) != 0; |
96 } | 91 } |
97 | 92 |
98 bool KeyboardEvdev::IsAutoRepeatEnabled() { | 93 bool KeyboardEvdev::IsAutoRepeatEnabled() { |
99 return repeat_enabled_; | 94 return repeat_enabled_; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 UpdateModifier(ModifierDomKeyToEventFlag(dom_key), down); | 192 UpdateModifier(ModifierDomKeyToEventFlag(dom_key), down); |
198 | 193 |
199 KeyEvent event(down ? ET_KEY_PRESSED : ET_KEY_RELEASED, key_code, dom_code, | 194 KeyEvent event(down ? ET_KEY_PRESSED : ET_KEY_RELEASED, key_code, dom_code, |
200 modifiers_->GetModifierFlags(), dom_key, character, timestamp); | 195 modifiers_->GetModifierFlags(), dom_key, character, timestamp); |
201 if (platform_keycode) | 196 if (platform_keycode) |
202 event.set_platform_keycode(platform_keycode); | 197 event.set_platform_keycode(platform_keycode); |
203 callback_.Run(&event); | 198 callback_.Run(&event); |
204 } | 199 } |
205 | 200 |
206 } // namespace ui | 201 } // namespace ui |
OLD | NEW |