| 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/Xlib.h> | 9 #include <X11/Xlib.h> |
| 10 #endif | 10 #endif |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 //////////////////////////////////////////////////////////////////////////////// | 520 //////////////////////////////////////////////////////////////////////////////// |
| 521 // KeyEvent | 521 // KeyEvent |
| 522 | 522 |
| 523 KeyEvent::KeyEvent(const base::NativeEvent& native_event, bool is_char) | 523 KeyEvent::KeyEvent(const base::NativeEvent& native_event, bool is_char) |
| 524 : Event(native_event, | 524 : Event(native_event, |
| 525 EventTypeFromNative(native_event), | 525 EventTypeFromNative(native_event), |
| 526 EventFlagsFromNative(native_event)), | 526 EventFlagsFromNative(native_event)), |
| 527 key_code_(KeyboardCodeFromNative(native_event)), | 527 key_code_(KeyboardCodeFromNative(native_event)), |
| 528 code_(CodeFromNative(native_event)), | 528 code_(CodeFromNative(native_event)), |
| 529 is_char_(is_char), | 529 is_char_(is_char), |
| 530 #if defined(USE_X11) |
| 531 is_fabricated_by_ime_(IsXKeyEventFabricatedByIme(native_event)), |
| 532 #else |
| 533 is_fabricated_by_ime_(false), |
| 534 #endif |
| 530 character_(0) { | 535 character_(0) { |
| 531 #if defined(USE_X11) | 536 #if defined(USE_X11) |
| 532 NormalizeFlags(); | 537 NormalizeFlags(); |
| 533 #endif | 538 #endif |
| 534 } | 539 } |
| 535 | 540 |
| 536 KeyEvent::KeyEvent(EventType type, | 541 KeyEvent::KeyEvent(EventType type, |
| 537 KeyboardCode key_code, | 542 KeyboardCode key_code, |
| 538 int flags, | 543 int flags, |
| 539 bool is_char) | 544 bool is_char) |
| 540 : Event(type, EventTimeForNow(), flags), | 545 : Event(type, EventTimeForNow(), flags), |
| 541 key_code_(key_code), | 546 key_code_(key_code), |
| 542 is_char_(is_char), | 547 is_char_(is_char), |
| 548 is_fabricated_by_ime_(false), |
| 543 character_(GetCharacterFromKeyCode(key_code, flags)) { | 549 character_(GetCharacterFromKeyCode(key_code, flags)) { |
| 544 } | 550 } |
| 545 | 551 |
| 546 KeyEvent::KeyEvent(EventType type, | 552 KeyEvent::KeyEvent(EventType type, |
| 547 KeyboardCode key_code, | 553 KeyboardCode key_code, |
| 548 const std::string& code, | 554 const std::string& code, |
| 549 int flags, | 555 int flags, |
| 550 bool is_char) | 556 bool is_char) |
| 551 : Event(type, EventTimeForNow(), flags), | 557 : Event(type, EventTimeForNow(), flags), |
| 552 key_code_(key_code), | 558 key_code_(key_code), |
| 553 code_(code), | 559 code_(code), |
| 554 is_char_(is_char), | 560 is_char_(is_char), |
| 561 is_fabricated_by_ime_(false), |
| 555 character_(GetCharacterFromKeyCode(key_code, flags)) { | 562 character_(GetCharacterFromKeyCode(key_code, flags)) { |
| 556 } | 563 } |
| 557 | 564 |
| 558 uint16 KeyEvent::GetCharacter() const { | 565 uint16 KeyEvent::GetCharacter() const { |
| 559 if (character_) | 566 if (character_) |
| 560 return character_; | 567 return character_; |
| 561 | 568 |
| 562 #if defined(OS_WIN) | 569 #if defined(OS_WIN) |
| 563 return (native_event().message == WM_CHAR) ? key_code_ : | 570 return (native_event().message == WM_CHAR) ? key_code_ : |
| 564 GetCharacterFromKeyCode(key_code_, flags()); | 571 GetCharacterFromKeyCode(key_code_, flags()); |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 731 int GestureEvent::GetLowestTouchId() const { | 738 int GestureEvent::GetLowestTouchId() const { |
| 732 if (touch_ids_bitfield_ == 0) | 739 if (touch_ids_bitfield_ == 0) |
| 733 return -1; | 740 return -1; |
| 734 int i = -1; | 741 int i = -1; |
| 735 // Find the index of the least significant 1 bit | 742 // Find the index of the least significant 1 bit |
| 736 while (!(1 << ++i & touch_ids_bitfield_)); | 743 while (!(1 << ++i & touch_ids_bitfield_)); |
| 737 return i; | 744 return i; |
| 738 } | 745 } |
| 739 | 746 |
| 740 } // namespace ui | 747 } // namespace ui |
| OLD | NEW |