OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/views/events/event.h" | 5 #include "ui/views/events/event.h" |
6 | 6 |
7 #include <gdk/gdk.h> | 7 #include <gdk/gdk.h> |
8 #include <gdk/gdkx.h> | 8 #include <gdk/gdkx.h> |
9 #include <X11/extensions/XInput2.h> | 9 #include <X11/extensions/XInput2.h> |
10 #include <X11/Xlib.h> | 10 #include <X11/Xlib.h> |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 if (ch) | 56 if (ch) |
57 return ch; | 57 return ch; |
58 } | 58 } |
59 #endif | 59 #endif |
60 return ui::GetCharacterFromKeyCode(key_code_, flags()); | 60 return ui::GetCharacterFromKeyCode(key_code_, flags()); |
61 } | 61 } |
62 | 62 |
63 DCHECK(native_event()->type == KeyPress || | 63 DCHECK(native_event()->type == KeyPress || |
64 native_event()->type == KeyRelease); | 64 native_event()->type == KeyRelease); |
65 | 65 |
66 uint16 ch = ui::DefaultSymbolFromXEvent(native_event()); | 66 uint16 ch = ui::GetCharacterFromXEvent(native_event()); |
67 return ch ? ch : ui::GetCharacterFromKeyCode(key_code_, flags()); | 67 return ch ? ch : ui::GetCharacterFromKeyCode(key_code_, flags()); |
68 } | 68 } |
69 | 69 |
70 uint16 KeyEvent::GetUnmodifiedCharacter() const { | 70 uint16 KeyEvent::GetUnmodifiedCharacter() const { |
71 if (unmodified_character_) | 71 if (unmodified_character_) |
72 return unmodified_character_; | 72 return unmodified_character_; |
73 | 73 |
74 if (!native_event()) { | 74 if (!native_event()) { |
75 #if defined(TOOLKIT_USES_GTK) | 75 #if defined(TOOLKIT_USES_GTK) |
76 // This event may have been created from a Gdk event. | 76 // This event may have been created from a Gdk event. |
(...skipping 25 matching lines...) Expand all Loading... |
102 native_event()->type == KeyRelease); | 102 native_event()->type == KeyRelease); |
103 | 103 |
104 XKeyEvent *key = &native_event()->xkey; | 104 XKeyEvent *key = &native_event()->xkey; |
105 | 105 |
106 static const unsigned int kIgnoredModifiers = ControlMask | LockMask | | 106 static const unsigned int kIgnoredModifiers = ControlMask | LockMask | |
107 Mod1Mask | Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask; | 107 Mod1Mask | Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask; |
108 | 108 |
109 // We can't use things like (key.state & ShiftMask), as it may mask out bits | 109 // We can't use things like (key.state & ShiftMask), as it may mask out bits |
110 // used by X11 internally. | 110 // used by X11 internally. |
111 key->state &= ~kIgnoredModifiers; | 111 key->state &= ~kIgnoredModifiers; |
112 uint16 ch = ui::DefaultSymbolFromXEvent(native_event()); | 112 uint16 ch = ui::GetCharacterFromXEvent(native_event()); |
113 return ch ? ch : | 113 return ch ? ch : |
114 ui::GetCharacterFromKeyCode(key_code_, flags() & ui::EF_SHIFT_DOWN); | 114 ui::GetCharacterFromKeyCode(key_code_, flags() & ui::EF_SHIFT_DOWN); |
115 } | 115 } |
116 | 116 |
117 //////////////////////////////////////////////////////////////////////////////// | 117 //////////////////////////////////////////////////////////////////////////////// |
118 // TouchEvent, public: | 118 // TouchEvent, public: |
119 | 119 |
120 TouchEvent::TouchEvent(const base::NativeEvent& native_event) | 120 TouchEvent::TouchEvent(const base::NativeEvent& native_event) |
121 : LocatedEvent(native_event), | 121 : LocatedEvent(native_event), |
122 touch_id_(ui::GetTouchId(native_event)), | 122 touch_id_(ui::GetTouchId(native_event)), |
(...skipping 20 matching lines...) Expand all Loading... |
143 float slot; | 143 float slot; |
144 if (factory->ExtractTouchParam(*native_event, | 144 if (factory->ExtractTouchParam(*native_event, |
145 ui::TouchFactory::TP_SLOT_ID, &slot)) { | 145 ui::TouchFactory::TP_SLOT_ID, &slot)) { |
146 factory->SetSlotUsed(slot, type() == ui::ET_TOUCH_PRESSED); | 146 factory->SetSlotUsed(slot, type() == ui::ET_TOUCH_PRESSED); |
147 } | 147 } |
148 } | 148 } |
149 #endif | 149 #endif |
150 } | 150 } |
151 | 151 |
152 } // namespace views | 152 } // namespace views |
OLD | NEW |