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/base/events/event.h" | 5 #include "ui/base/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 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
455 } | 455 } |
456 | 456 |
457 TouchEvent::~TouchEvent() { | 457 TouchEvent::~TouchEvent() { |
458 } | 458 } |
459 | 459 |
460 void TouchEvent::Relocate(const gfx::Point& origin) { | 460 void TouchEvent::Relocate(const gfx::Point& origin) { |
461 location_ -= origin.OffsetFromOrigin(); | 461 location_ -= origin.OffsetFromOrigin(); |
462 root_location_ -= origin.OffsetFromOrigin(); | 462 root_location_ -= origin.OffsetFromOrigin(); |
463 } | 463 } |
464 | 464 |
465 void TouchEvent::UpdateForRootTransform(const gfx::Transform& root_transform) { | 465 void TouchEvent::UpdateForRootTransform( |
466 LocatedEvent::UpdateForRootTransform(root_transform); | 466 const gfx::Transform& inverted_root_transform) { |
467 LocatedEvent::UpdateForRootTransform(inverted_root_transform); | |
467 gfx::DecomposedTransform decomp; | 468 gfx::DecomposedTransform decomp; |
468 bool success = gfx::DecomposeTransform(&decomp, root_transform); | 469 bool success = gfx::DecomposeTransform(&decomp, inverted_root_transform); |
469 DCHECK(success); | 470 DCHECK(success); |
470 if (decomp.scale[0]) | 471 if (decomp.scale[0]) |
471 radius_x_ /= decomp.scale[0]; | 472 radius_x_ *= decomp.scale[0]; |
472 if (decomp.scale[1]) | 473 if (decomp.scale[1]) |
473 radius_y_ /= decomp.scale[1]; | 474 radius_y_ *= decomp.scale[1]; |
474 } | 475 } |
475 | 476 |
476 //////////////////////////////////////////////////////////////////////////////// | 477 //////////////////////////////////////////////////////////////////////////////// |
477 // KeyEvent | 478 // KeyEvent |
478 | 479 |
479 KeyEvent::KeyEvent(const base::NativeEvent& native_event, bool is_char) | 480 KeyEvent::KeyEvent(const base::NativeEvent& native_event, bool is_char) |
480 : Event(native_event, | 481 : Event(native_event, |
481 EventTypeFromNative(native_event), | 482 EventTypeFromNative(native_event), |
482 EventFlagsFromNative(native_event)), | 483 EventFlagsFromNative(native_event)), |
483 key_code_(KeyboardCodeFromNative(native_event)), | 484 key_code_(KeyboardCodeFromNative(native_event)), |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
689 x_offset_ordinal_ *= factor; | 690 x_offset_ordinal_ *= factor; |
690 y_offset_ordinal_ *= factor; | 691 y_offset_ordinal_ *= factor; |
691 } | 692 } |
692 | 693 |
693 void ScrollEvent::UpdateForRootTransform(const gfx::Transform& root_transform) { | 694 void ScrollEvent::UpdateForRootTransform(const gfx::Transform& root_transform) { |
694 LocatedEvent::UpdateForRootTransform(root_transform); | 695 LocatedEvent::UpdateForRootTransform(root_transform); |
695 gfx::DecomposedTransform decomp; | 696 gfx::DecomposedTransform decomp; |
696 bool success = gfx::DecomposeTransform(&decomp, root_transform); | 697 bool success = gfx::DecomposeTransform(&decomp, root_transform); |
697 DCHECK(success); | 698 DCHECK(success); |
698 if (decomp.scale[0]) | 699 if (decomp.scale[0]) |
699 x_offset_ordinal_ /= decomp.scale[0]; | 700 x_offset_ordinal_ /= decomp.scale[0]; |
sadrul
2013/04/03 23:09:04
Please fix these too?
Yufeng Shen (Slow to review)
2013/04/03 23:19:15
Done.
| |
700 if (decomp.scale[1]) | 701 if (decomp.scale[1]) |
701 y_offset_ordinal_ /= decomp.scale[1]; | 702 y_offset_ordinal_ /= decomp.scale[1]; |
702 } | 703 } |
703 | 704 |
704 //////////////////////////////////////////////////////////////////////////////// | 705 //////////////////////////////////////////////////////////////////////////////// |
705 // GestureEvent | 706 // GestureEvent |
706 | 707 |
707 GestureEvent::GestureEvent(EventType type, | 708 GestureEvent::GestureEvent(EventType type, |
708 int x, | 709 int x, |
709 int y, | 710 int y, |
(...skipping 16 matching lines...) Expand all Loading... | |
726 int GestureEvent::GetLowestTouchId() const { | 727 int GestureEvent::GetLowestTouchId() const { |
727 if (touch_ids_bitfield_ == 0) | 728 if (touch_ids_bitfield_ == 0) |
728 return -1; | 729 return -1; |
729 int i = -1; | 730 int i = -1; |
730 // Find the index of the least significant 1 bit | 731 // Find the index of the least significant 1 bit |
731 while (!(1 << ++i & touch_ids_bitfield_)); | 732 while (!(1 << ++i & touch_ids_bitfield_)); |
732 return i; | 733 return i; |
733 } | 734 } |
734 | 735 |
735 } // namespace ui | 736 } // namespace ui |
OLD | NEW |