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 17 matching lines...) Expand all Loading... | |
28 case EF_CAPS_LOCK_DOWN: | 28 case EF_CAPS_LOCK_DOWN: |
29 return EVDEV_MODIFIER_CAPS_LOCK; | 29 return EVDEV_MODIFIER_CAPS_LOCK; |
30 case EF_SHIFT_DOWN: | 30 case EF_SHIFT_DOWN: |
31 return EVDEV_MODIFIER_SHIFT; | 31 return EVDEV_MODIFIER_SHIFT; |
32 case EF_CONTROL_DOWN: | 32 case EF_CONTROL_DOWN: |
33 return EVDEV_MODIFIER_CONTROL; | 33 return EVDEV_MODIFIER_CONTROL; |
34 case EF_ALT_DOWN: | 34 case EF_ALT_DOWN: |
35 return EVDEV_MODIFIER_ALT; | 35 return EVDEV_MODIFIER_ALT; |
36 case EF_ALTGR_DOWN: | 36 case EF_ALTGR_DOWN: |
37 return EVDEV_MODIFIER_ALTGR; | 37 return EVDEV_MODIFIER_ALTGR; |
38 case EF_MOD3_DOWN: | |
39 return EVDEV_MODIFIER_MOD3; | |
38 case EF_LEFT_MOUSE_BUTTON: | 40 case EF_LEFT_MOUSE_BUTTON: |
39 return EVDEV_MODIFIER_LEFT_MOUSE_BUTTON; | 41 return EVDEV_MODIFIER_LEFT_MOUSE_BUTTON; |
40 case EF_MIDDLE_MOUSE_BUTTON: | 42 case EF_MIDDLE_MOUSE_BUTTON: |
41 return EVDEV_MODIFIER_MIDDLE_MOUSE_BUTTON; | 43 return EVDEV_MODIFIER_MIDDLE_MOUSE_BUTTON; |
42 case EF_RIGHT_MOUSE_BUTTON: | 44 case EF_RIGHT_MOUSE_BUTTON: |
43 return EVDEV_MODIFIER_RIGHT_MOUSE_BUTTON; | 45 return EVDEV_MODIFIER_RIGHT_MOUSE_BUTTON; |
44 case EF_BACK_MOUSE_BUTTON: | 46 case EF_BACK_MOUSE_BUTTON: |
45 return EVDEV_MODIFIER_BACK_MOUSE_BUTTON; | 47 return EVDEV_MODIFIER_BACK_MOUSE_BUTTON; |
46 case EF_FORWARD_MOUSE_BUTTON: | 48 case EF_FORWARD_MOUSE_BUTTON: |
47 return EVDEV_MODIFIER_FORWARD_MOUSE_BUTTON; | 49 return EVDEV_MODIFIER_FORWARD_MOUSE_BUTTON; |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
207 return; | 209 return; |
208 int flags = modifiers_->GetModifierFlags(); | 210 int flags = modifiers_->GetModifierFlags(); |
209 DomKey dom_key; | 211 DomKey dom_key; |
210 KeyboardCode key_code; | 212 KeyboardCode key_code; |
211 uint16 character; | 213 uint16 character; |
212 uint32 platform_keycode = 0; | 214 uint32 platform_keycode = 0; |
213 if (!keyboard_layout_engine_->Lookup(dom_code, flags, &dom_key, &character, | 215 if (!keyboard_layout_engine_->Lookup(dom_code, flags, &dom_key, &character, |
214 &key_code, &platform_keycode)) { | 216 &key_code, &platform_keycode)) { |
215 return; | 217 return; |
216 } | 218 } |
217 if (!repeat) | 219 if (!repeat) { |
218 UpdateModifier(ModifierDomKeyToEventFlag(dom_key), down); | 220 int flag = ModifierDomKeyToEventFlag(dom_key); |
221 UpdateModifier(flag, down); | |
222 // X11 XKB, using the configuration as modified for ChromeOS, always sets | |
223 // EF_MOD3_DOWN for the physical CapsLock key, so we imitate this to make | |
224 // certain layouts work. crbug.com/495277 | |
225 if (static_cast<int>(dom_code) == 0x070039) | |
kpschoedel
2015/06/08 20:11:32
Oops — forgot to do something about this before up
kpschoedel
2015/06/08 20:53:03
Done.
| |
226 UpdateModifier(EF_MOD3_DOWN, down); | |
227 } | |
219 | 228 |
220 KeyEvent event(down ? ET_KEY_PRESSED : ET_KEY_RELEASED, key_code, dom_code, | 229 KeyEvent event(down ? ET_KEY_PRESSED : ET_KEY_RELEASED, key_code, dom_code, |
221 modifiers_->GetModifierFlags(), dom_key, character, timestamp); | 230 modifiers_->GetModifierFlags(), dom_key, character, timestamp); |
222 event.set_source_device_id(device_id); | 231 event.set_source_device_id(device_id); |
223 if (platform_keycode) | 232 if (platform_keycode) |
224 event.set_platform_keycode(platform_keycode); | 233 event.set_platform_keycode(platform_keycode); |
225 callback_.Run(&event); | 234 callback_.Run(&event); |
226 } | 235 } |
227 | |
228 } // namespace ui | 236 } // namespace ui |
OLD | NEW |