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/aura/event.h" | 5 #include "ui/aura/event.h" |
6 | 6 |
7 #if defined(USE_X11) | 7 #if defined(USE_X11) |
8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 #if defined(OS_WIN) | 204 #if defined(OS_WIN) |
205 return (native_event().message == WM_CHAR) ? key_code_ : | 205 return (native_event().message == WM_CHAR) ? key_code_ : |
206 ui::GetCharacterFromKeyCode(key_code_, flags()); | 206 ui::GetCharacterFromKeyCode(key_code_, flags()); |
207 #elif defined(USE_X11) | 207 #elif defined(USE_X11) |
208 if (!native_event()) | 208 if (!native_event()) |
209 return ui::GetCharacterFromKeyCode(key_code_, flags()); | 209 return ui::GetCharacterFromKeyCode(key_code_, flags()); |
210 | 210 |
211 DCHECK(native_event()->type == KeyPress || | 211 DCHECK(native_event()->type == KeyPress || |
212 native_event()->type == KeyRelease); | 212 native_event()->type == KeyRelease); |
213 | 213 |
214 uint16 ch = ui::DefaultSymbolFromXEvent(native_event()); | 214 uint16 ch = ui::GetCharacterFromXEvent(native_event()); |
215 return ch ? ch : ui::GetCharacterFromKeyCode(key_code_, flags()); | 215 return ch ? ch : ui::GetCharacterFromKeyCode(key_code_, flags()); |
216 #else | 216 #else |
217 NOTIMPLEMENTED(); | 217 NOTIMPLEMENTED(); |
218 return 0; | 218 return 0; |
219 #endif | 219 #endif |
220 } | 220 } |
221 | 221 |
222 uint16 KeyEvent::GetUnmodifiedCharacter() const { | 222 uint16 KeyEvent::GetUnmodifiedCharacter() const { |
223 if (unmodified_character_) | 223 if (unmodified_character_) |
224 return unmodified_character_; | 224 return unmodified_character_; |
(...skipping 10 matching lines...) Expand all Loading... |
235 native_event()->type == KeyRelease); | 235 native_event()->type == KeyRelease); |
236 | 236 |
237 XKeyEvent *key = &native_event()->xkey; | 237 XKeyEvent *key = &native_event()->xkey; |
238 | 238 |
239 static const unsigned int kIgnoredModifiers = ControlMask | LockMask | | 239 static const unsigned int kIgnoredModifiers = ControlMask | LockMask | |
240 Mod1Mask | Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask; | 240 Mod1Mask | Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask; |
241 | 241 |
242 // We can't use things like (key.state & ShiftMask), as it may mask out bits | 242 // We can't use things like (key.state & ShiftMask), as it may mask out bits |
243 // used by X11 internally. | 243 // used by X11 internally. |
244 key->state &= ~kIgnoredModifiers; | 244 key->state &= ~kIgnoredModifiers; |
245 uint16 ch = ui::DefaultSymbolFromXEvent(native_event()); | 245 uint16 ch = ui::GetCharacterFromXEvent(native_event()); |
246 return ch ? ch : | 246 return ch ? ch : |
247 ui::GetCharacterFromKeyCode(key_code_, flags() & ui::EF_SHIFT_DOWN); | 247 ui::GetCharacterFromKeyCode(key_code_, flags() & ui::EF_SHIFT_DOWN); |
248 #else | 248 #else |
249 NOTIMPLEMENTED(); | 249 NOTIMPLEMENTED(); |
250 return 0; | 250 return 0; |
251 #endif | 251 #endif |
252 } | 252 } |
253 | 253 |
254 } // namespace aura | 254 } // namespace aura |
OLD | NEW |