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 "base/single_thread_task_runner.h" | 7 #include "base/single_thread_task_runner.h" |
8 #include "base/thread_task_runner_handle.h" | 8 #include "base/thread_task_runner_handle.h" |
9 #include "ui/events/event.h" | 9 #include "ui/events/event.h" |
10 #include "ui/events/event_constants.h" | 10 #include "ui/events/event_constants.h" |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 bool repeat, | 205 bool repeat, |
206 base::TimeDelta timestamp, | 206 base::TimeDelta timestamp, |
207 int device_id) { | 207 int device_id) { |
208 DomCode dom_code = | 208 DomCode dom_code = |
209 KeycodeConverter::NativeKeycodeToDomCode(EvdevCodeToNativeCode(key)); | 209 KeycodeConverter::NativeKeycodeToDomCode(EvdevCodeToNativeCode(key)); |
210 if (dom_code == DomCode::DOM_CODE_NONE) | 210 if (dom_code == DomCode::DOM_CODE_NONE) |
211 return; | 211 return; |
212 int flags = modifiers_->GetModifierFlags(); | 212 int flags = modifiers_->GetModifierFlags(); |
213 DomKey dom_key; | 213 DomKey dom_key; |
214 KeyboardCode key_code; | 214 KeyboardCode key_code; |
215 uint16 character; | |
216 uint32 platform_keycode = 0; | 215 uint32 platform_keycode = 0; |
217 if (!keyboard_layout_engine_->Lookup(dom_code, flags, &dom_key, &character, | 216 if (!keyboard_layout_engine_->Lookup(dom_code, flags, &dom_key, |
218 &key_code, &platform_keycode)) { | 217 &key_code, &platform_keycode)) { |
219 return; | 218 return; |
220 } | 219 } |
221 if (!repeat) { | 220 if (!repeat) { |
222 int flag = ModifierDomKeyToEventFlag(dom_key); | 221 int flag = ModifierDomKeyToEventFlag(dom_key); |
223 UpdateModifier(flag, down); | 222 UpdateModifier(flag, down); |
224 } | 223 } |
225 | 224 |
226 KeyEvent event(down ? ET_KEY_PRESSED : ET_KEY_RELEASED, key_code, dom_code, | 225 KeyEvent event(down ? ET_KEY_PRESSED : ET_KEY_RELEASED, key_code, dom_code, |
227 modifiers_->GetModifierFlags(), dom_key, character, timestamp); | 226 modifiers_->GetModifierFlags(), dom_key, timestamp); |
228 event.set_source_device_id(device_id); | 227 event.set_source_device_id(device_id); |
229 if (platform_keycode) | 228 if (platform_keycode) |
230 event.set_platform_keycode(platform_keycode); | 229 event.set_platform_keycode(platform_keycode); |
231 callback_.Run(&event); | 230 callback_.Run(&event); |
232 } | 231 } |
233 } // namespace ui | 232 } // namespace ui |
OLD | NEW |