Chromium Code Reviews| 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 #ifndef UI_EVENTS_EVENT_H_ | 5 #ifndef UI_EVENTS_EVENT_H_ |
| 6 #define UI_EVENTS_EVENT_H_ | 6 #define UI_EVENTS_EVENT_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/event_types.h" | 10 #include "base/event_types.h" |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 527 // Used for synthetic events with code of DOM KeyboardEvent (e.g. 'KeyA') | 527 // Used for synthetic events with code of DOM KeyboardEvent (e.g. 'KeyA') |
| 528 // See also: ui/events/keycodes/dom4/keycode_converter_data.h | 528 // See also: ui/events/keycodes/dom4/keycode_converter_data.h |
| 529 KeyEvent(EventType type, KeyboardCode key_code, const std::string& code, | 529 KeyEvent(EventType type, KeyboardCode key_code, const std::string& code, |
| 530 int flags, bool is_char); | 530 int flags, bool is_char); |
| 531 | 531 |
| 532 // This allows an I18N virtual keyboard to fabricate a keyboard event that | 532 // This allows an I18N virtual keyboard to fabricate a keyboard event that |
| 533 // does not have a corresponding KeyboardCode (example: U+00E1 Latin small | 533 // does not have a corresponding KeyboardCode (example: U+00E1 Latin small |
| 534 // letter A with acute, U+0410 Cyrillic capital letter A). | 534 // letter A with acute, U+0410 Cyrillic capital letter A). |
| 535 void set_character(uint16 character) { character_ = character; } | 535 void set_character(uint16 character) { character_ = character; } |
| 536 | 536 |
| 537 // This allows some platforms other than XKB to set its original key code. | |
| 538 // e.g. Key event from Ozone will not have native key event. So it can use | |
| 539 // this method to set the xksym value. | |
| 540 void set_platform_keycode(uint32 keycode) { platform_keycode_ = keycode; } | |
|
sadrul
2014/06/12 11:17:43
This isn't actually necessary, is it?
Shu Chen
2014/06/12 13:55:30
Yes, this cl doesn't have code uses this method.
A
kpschoedel
2014/06/12 16:00:24
I have done similar things for issue 380349. There
Shu Chen
2014/06/13 02:07:15
Done. I've removed this method.
| |
| 541 | |
| 537 // Gets the character generated by this key event. It only supports Unicode | 542 // Gets the character generated by this key event. It only supports Unicode |
| 538 // BMP characters. | 543 // BMP characters. |
| 539 uint16 GetCharacter() const; | 544 uint16 GetCharacter() const; |
| 540 | 545 |
| 546 // Gets the platform key code. For XKB, this is the xksym value. | |
| 547 uint32 platform_keycode() const { return platform_keycode_; } | |
| 541 KeyboardCode key_code() const { return key_code_; } | 548 KeyboardCode key_code() const { return key_code_; } |
| 542 bool is_char() const { return is_char_; } | 549 bool is_char() const { return is_char_; } |
| 543 | 550 |
| 544 // This is only intended to be used externally by classes that are modifying | 551 // This is only intended to be used externally by classes that are modifying |
| 545 // events in EventFilter::PreHandleKeyEvent(). set_character() should also be | 552 // events in EventFilter::PreHandleKeyEvent(). set_character() should also be |
| 546 // called. | 553 // called. |
| 547 void set_key_code(KeyboardCode key_code) { key_code_ = key_code; } | 554 void set_key_code(KeyboardCode key_code) { key_code_ = key_code; } |
| 548 | 555 |
| 549 // Returns true for [Alt]+<num-pad digit> Unicode alt key codes used by Win. | 556 // Returns true for [Alt]+<num-pad digit> Unicode alt key codes used by Win. |
| 550 // TODO(msw): Additional work may be needed for analogues on other platforms. | 557 // TODO(msw): Additional work may be needed for analogues on other platforms. |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 574 // http://www.w3.org/TR/uievents/#keyboard-key-codes. | 581 // http://www.w3.org/TR/uievents/#keyboard-key-codes. |
| 575 // | 582 // |
| 576 // This value represents the physical position in the keyboard and can be | 583 // This value represents the physical position in the keyboard and can be |
| 577 // converted from / to keyboard scan code like XKB. | 584 // converted from / to keyboard scan code like XKB. |
| 578 std::string code_; | 585 std::string code_; |
| 579 | 586 |
| 580 // True if this is a translated character event (vs. a raw key down). Both | 587 // True if this is a translated character event (vs. a raw key down). Both |
| 581 // share the same type: ET_KEY_PRESSED. | 588 // share the same type: ET_KEY_PRESSED. |
| 582 bool is_char_; | 589 bool is_char_; |
| 583 | 590 |
| 591 uint32 platform_keycode_; | |
| 592 | |
| 584 uint16 character_; | 593 uint16 character_; |
|
sadrul
2014/06/12 11:17:43
Can you add a comment here explaining the differen
Shu Chen
2014/06/12 13:55:30
Done.
| |
| 585 | 594 |
| 586 static bool IsRepeated(const KeyEvent& event); | 595 static bool IsRepeated(const KeyEvent& event); |
| 587 | 596 |
| 588 static KeyEvent* last_key_event_; | 597 static KeyEvent* last_key_event_; |
| 589 }; | 598 }; |
| 590 | 599 |
| 591 class EVENTS_EXPORT ScrollEvent : public MouseEvent { | 600 class EVENTS_EXPORT ScrollEvent : public MouseEvent { |
| 592 public: | 601 public: |
| 593 explicit ScrollEvent(const base::NativeEvent& native_event); | 602 explicit ScrollEvent(const base::NativeEvent& native_event); |
| 594 template <class T> | 603 template <class T> |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 670 // The set of indices of ones in the binary representation of | 679 // The set of indices of ones in the binary representation of |
| 671 // touch_ids_bitfield_ is the set of touch_ids associate with this gesture. | 680 // touch_ids_bitfield_ is the set of touch_ids associate with this gesture. |
| 672 // This value is stored as a bitfield because the number of touch ids varies, | 681 // This value is stored as a bitfield because the number of touch ids varies, |
| 673 // but we currently don't need more than 32 touches at a time. | 682 // but we currently don't need more than 32 touches at a time. |
| 674 const unsigned int touch_ids_bitfield_; | 683 const unsigned int touch_ids_bitfield_; |
| 675 }; | 684 }; |
| 676 | 685 |
| 677 } // namespace ui | 686 } // namespace ui |
| 678 | 687 |
| 679 #endif // UI_EVENTS_EVENT_H_ | 688 #endif // UI_EVENTS_EVENT_H_ |
| OLD | NEW |