| 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/Xlib.h> | 8 #include <X11/Xlib.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 uint16 ch = 0; | 560 uint16 ch = 0; |
| 561 if (!IsControlDown()) | 561 if (!IsControlDown()) |
| 562 ch = GetCharacterFromXEvent(native_event()); | 562 ch = GetCharacterFromXEvent(native_event()); |
| 563 return ch ? ch : GetCharacterFromKeyCode(key_code_, flags()); | 563 return ch ? ch : GetCharacterFromKeyCode(key_code_, flags()); |
| 564 #else | 564 #else |
| 565 NOTIMPLEMENTED(); | 565 NOTIMPLEMENTED(); |
| 566 return 0; | 566 return 0; |
| 567 #endif | 567 #endif |
| 568 } | 568 } |
| 569 | 569 |
| 570 KeyEvent* KeyEvent::Copy() const { | |
| 571 #if defined(USE_OZONE) | |
| 572 KeyEvent* copy = new KeyEvent(*this); | |
| 573 #else | |
| 574 KeyEvent* copy = HasNativeEvent() ? | |
| 575 new KeyEvent(::CopyNativeEvent(native_event()), is_char()) : | |
| 576 new KeyEvent(*this); | |
| 577 #endif | |
| 578 #if defined(USE_X11) | |
| 579 copy->set_delete_native_event(true); | |
| 580 #endif | |
| 581 return copy; | |
| 582 } | |
| 583 | |
| 584 bool KeyEvent::IsUnicodeKeyCode() const { | 570 bool KeyEvent::IsUnicodeKeyCode() const { |
| 585 if (!IsAltDown()) | 571 if (!IsAltDown()) |
| 586 return false; | 572 return false; |
| 587 const int key = key_code(); | 573 const int key = key_code(); |
| 588 if (key >= VKEY_NUMPAD0 && key <= VKEY_NUMPAD9) | 574 if (key >= VKEY_NUMPAD0 && key <= VKEY_NUMPAD9) |
| 589 return true; | 575 return true; |
| 590 // Check whether the user is using the numeric keypad with num-lock off. | 576 // Check whether the user is using the numeric keypad with num-lock off. |
| 591 // In that case, EF_EXTENDED will not be set; if it is set, the key event | 577 // In that case, EF_EXTENDED will not be set; if it is set, the key event |
| 592 // originated from the relevant non-numpad dedicated key, e.g. [Insert]. | 578 // originated from the relevant non-numpad dedicated key, e.g. [Insert]. |
| 593 return (!(flags() & EF_EXTENDED) && | 579 return (!(flags() & EF_EXTENDED) && |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 int GestureEvent::GetLowestTouchId() const { | 704 int GestureEvent::GetLowestTouchId() const { |
| 719 if (touch_ids_bitfield_ == 0) | 705 if (touch_ids_bitfield_ == 0) |
| 720 return -1; | 706 return -1; |
| 721 int i = -1; | 707 int i = -1; |
| 722 // Find the index of the least significant 1 bit | 708 // Find the index of the least significant 1 bit |
| 723 while (!(1 << ++i & touch_ids_bitfield_)); | 709 while (!(1 << ++i & touch_ids_bitfield_)); |
| 724 return i; | 710 return i; |
| 725 } | 711 } |
| 726 | 712 |
| 727 } // namespace ui | 713 } // namespace ui |
| OLD | NEW |