| 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 uint32 platform_keycode = 0; | 215 if (!keyboard_layout_engine_->Lookup(dom_code, flags, &dom_key, &key_code)) |
| 216 if (!keyboard_layout_engine_->Lookup(dom_code, flags, &dom_key, | |
| 217 &key_code, &platform_keycode)) { | |
| 218 return; | 216 return; |
| 219 } | |
| 220 if (!repeat) { | 217 if (!repeat) { |
| 221 int flag = ModifierDomKeyToEventFlag(dom_key); | 218 int flag = ModifierDomKeyToEventFlag(dom_key); |
| 222 UpdateModifier(flag, down); | 219 UpdateModifier(flag, down); |
| 223 } | 220 } |
| 224 | 221 |
| 225 KeyEvent event(down ? ET_KEY_PRESSED : ET_KEY_RELEASED, key_code, dom_code, | 222 KeyEvent event(down ? ET_KEY_PRESSED : ET_KEY_RELEASED, key_code, dom_code, |
| 226 modifiers_->GetModifierFlags(), dom_key, timestamp); | 223 modifiers_->GetModifierFlags(), dom_key, timestamp); |
| 227 event.set_source_device_id(device_id); | 224 event.set_source_device_id(device_id); |
| 228 if (platform_keycode) | |
| 229 event.set_platform_keycode(platform_keycode); | |
| 230 callback_.Run(&event); | 225 callback_.Run(&event); |
| 231 } | 226 } |
| 227 |
| 232 } // namespace ui | 228 } // namespace ui |
| OLD | NEW |