OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/event.h" | 5 #include "ui/events/event.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #if defined(USE_X11) | 9 #if defined(USE_X11) |
10 #include <X11/extensions/XInput2.h> | 10 #include <X11/extensions/XInput2.h> |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "ui/gfx/transform.h" | 30 #include "ui/gfx/transform.h" |
31 #include "ui/gfx/transform_util.h" | 31 #include "ui/gfx/transform_util.h" |
32 | 32 |
33 #if defined(USE_X11) | 33 #if defined(USE_X11) |
34 #include "ui/events/keycodes/keyboard_code_conversion_x.h" | 34 #include "ui/events/keycodes/keyboard_code_conversion_x.h" |
35 #elif defined(USE_OZONE) | 35 #elif defined(USE_OZONE) |
36 #include "ui/events/ozone/layout/keyboard_layout_engine.h" // nogncheck | 36 #include "ui/events/ozone/layout/keyboard_layout_engine.h" // nogncheck |
37 #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h" // nogncheck | 37 #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h" // nogncheck |
38 #endif | 38 #endif |
39 | 39 |
| 40 #if defined(OS_WIN) |
| 41 #include "ui/events/keycodes/keyboard_lookup_win.h" |
| 42 #endif |
| 43 |
40 namespace { | 44 namespace { |
41 | 45 |
42 std::string EventTypeName(ui::EventType type) { | 46 std::string EventTypeName(ui::EventType type) { |
43 #define RETURN_IF_TYPE(t) if (type == ui::t) return #t | 47 #define RETURN_IF_TYPE(t) if (type == ui::t) return #t |
44 #define CASE_TYPE(t) case ui::t: return #t | 48 #define CASE_TYPE(t) case ui::t: return #t |
45 switch (type) { | 49 switch (type) { |
46 CASE_TYPE(ET_UNKNOWN); | 50 CASE_TYPE(ET_UNKNOWN); |
47 CASE_TYPE(ET_MOUSE_PRESSED); | 51 CASE_TYPE(ET_MOUSE_PRESSED); |
48 CASE_TYPE(ET_MOUSE_DRAGGED); | 52 CASE_TYPE(ET_MOUSE_DRAGGED); |
49 CASE_TYPE(ET_MOUSE_RELEASED); | 53 CASE_TYPE(ET_MOUSE_RELEASED); |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 if (IsRepeated(*this)) | 694 if (IsRepeated(*this)) |
691 set_flags(flags() | ui::EF_IS_REPEAT); | 695 set_flags(flags() | ui::EF_IS_REPEAT); |
692 | 696 |
693 #if defined(USE_X11) | 697 #if defined(USE_X11) |
694 NormalizeFlags(); | 698 NormalizeFlags(); |
695 #endif | 699 #endif |
696 #if defined(OS_WIN) | 700 #if defined(OS_WIN) |
697 // Only Windows has native character events. | 701 // Only Windows has native character events. |
698 if (is_char_) | 702 if (is_char_) |
699 key_ = DomKey::FromCharacter(native_event.wParam); | 703 key_ = DomKey::FromCharacter(native_event.wParam); |
| 704 else |
| 705 key_ = WindowsKeyboardLookup::VirtualKeyToCurrentLayoutDomKey(key_code_, |
| 706 flags()); |
700 #endif | 707 #endif |
701 } | 708 } |
702 | 709 |
703 KeyEvent::KeyEvent(EventType type, | 710 KeyEvent::KeyEvent(EventType type, |
704 KeyboardCode key_code, | 711 KeyboardCode key_code, |
705 int flags) | 712 int flags) |
706 : Event(type, EventTimeForNow(), flags), | 713 : Event(type, EventTimeForNow(), flags), |
707 key_code_(key_code), | 714 key_code_(key_code), |
708 code_(UsLayoutKeyboardCodeToDomCode(key_code)) { | 715 code_(UsLayoutKeyboardCodeToDomCode(key_code)) { |
709 } | 716 } |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
982 gfx::PointF(x, y), | 989 gfx::PointF(x, y), |
983 time_stamp, | 990 time_stamp, |
984 flags | EF_FROM_TOUCH), | 991 flags | EF_FROM_TOUCH), |
985 details_(details) { | 992 details_(details) { |
986 } | 993 } |
987 | 994 |
988 GestureEvent::~GestureEvent() { | 995 GestureEvent::~GestureEvent() { |
989 } | 996 } |
990 | 997 |
991 } // namespace ui | 998 } // namespace ui |
OLD | NEW |