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 #if defined(USE_X11) | 7 #if defined(USE_X11) |
8 #include <X11/extensions/XInput2.h> | 8 #include <X11/extensions/XInput2.h> |
9 #include <X11/keysym.h> | 9 #include <X11/keysym.h> |
10 #include <X11/Xlib.h> | 10 #include <X11/Xlib.h> |
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 return key_; | 831 return key_; |
832 } | 832 } |
833 | 833 |
834 base::char16 KeyEvent::GetCharacter() const { | 834 base::char16 KeyEvent::GetCharacter() const { |
835 // Determination of character_ and key_ may be done lazily. | 835 // Determination of character_ and key_ may be done lazily. |
836 if (key_ == DomKey::NONE) | 836 if (key_ == DomKey::NONE) |
837 ApplyLayout(); | 837 ApplyLayout(); |
838 return character_; | 838 return character_; |
839 } | 839 } |
840 | 840 |
| 841 int KeyEvent::GetDomKeyOrCharacter() const { |
| 842 // Determination of character_ and key_ may be done lazily. |
| 843 base::char16 dom_char = GetCharacter(); |
| 844 ui::DomKey dom_key = GetDomKey(); |
| 845 if (dom_key == DomKey::CHARACTER) |
| 846 return dom_char + static_cast<int>(DomKey::CHARACTER); |
| 847 else |
| 848 return static_cast<int>(dom_key); |
| 849 } |
| 850 |
841 base::char16 KeyEvent::GetText() const { | 851 base::char16 KeyEvent::GetText() const { |
842 if ((flags() & EF_CONTROL_DOWN) != 0) { | 852 if ((flags() & EF_CONTROL_DOWN) != 0) { |
843 base::char16 character; | 853 base::char16 character; |
844 ui::DomKey key; | 854 ui::DomKey key; |
845 ui::KeyboardCode key_code; | 855 ui::KeyboardCode key_code; |
846 if (DomCodeToControlCharacter(code_, flags(), &key, &character, &key_code)) | 856 if (DomCodeToControlCharacter(code_, flags(), &key, &character, &key_code)) |
847 return character; | 857 return character; |
848 } | 858 } |
849 return GetUnmodifiedText(); | 859 return GetUnmodifiedText(); |
850 } | 860 } |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
973 gfx::PointF(x, y), | 983 gfx::PointF(x, y), |
974 time_stamp, | 984 time_stamp, |
975 flags | EF_FROM_TOUCH), | 985 flags | EF_FROM_TOUCH), |
976 details_(details) { | 986 details_(details) { |
977 } | 987 } |
978 | 988 |
979 GestureEvent::~GestureEvent() { | 989 GestureEvent::~GestureEvent() { |
980 } | 990 } |
981 | 991 |
982 } // namespace ui | 992 } // namespace ui |
OLD | NEW |