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 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 | 10 |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 reversed_root_transform.TransformPoint(&p); | 496 reversed_root_transform.TransformPoint(&p); |
497 location_ = p.AsPointF(); | 497 location_ = p.AsPointF(); |
498 root_location_ = location_; | 498 root_location_ = location_; |
499 } | 499 } |
500 | 500 |
501 //////////////////////////////////////////////////////////////////////////////// | 501 //////////////////////////////////////////////////////////////////////////////// |
502 // PointerDetails | 502 // PointerDetails |
503 | 503 |
504 PointerDetails::PointerDetails() {} | 504 PointerDetails::PointerDetails() {} |
505 | 505 |
506 PointerDetails::PointerDetails(EventPointerType pointer_type, int pointer_id) | 506 PointerDetails::PointerDetails(EventPointerType pointer_type, |
| 507 PointerId pointer_id) |
507 : PointerDetails(pointer_type, | 508 : PointerDetails(pointer_type, |
508 pointer_id, | 509 pointer_id, |
509 /* radius_x */ 0.0f, | 510 /* radius_x */ 0.0f, |
510 /* radius_y */ 0.0f, | 511 /* radius_y */ 0.0f, |
511 /* force */ std::numeric_limits<float>::quiet_NaN()) {} | 512 /* force */ std::numeric_limits<float>::quiet_NaN()) {} |
512 | 513 |
513 PointerDetails::PointerDetails(EventPointerType pointer_type, | 514 PointerDetails::PointerDetails(EventPointerType pointer_type, |
514 int pointer_id, | 515 PointerId pointer_id, |
515 float radius_x, | 516 float radius_x, |
516 float radius_y, | 517 float radius_y, |
517 float force, | 518 float force, |
518 float tilt_x, | 519 float tilt_x, |
519 float tilt_y, | 520 float tilt_y, |
520 float tangential_pressure, | 521 float tangential_pressure, |
521 int twist) | 522 int twist) |
522 : pointer_type(pointer_type), | 523 : pointer_type(pointer_type), |
523 // If we aren't provided with a radius on one axis, use the | 524 // If we aren't provided with a radius on one axis, use the |
524 // information from the other axis. | 525 // information from the other axis. |
525 radius_x(radius_x > 0 ? radius_x : radius_y), | 526 radius_x(radius_x > 0 ? radius_x : radius_y), |
526 radius_y(radius_y > 0 ? radius_y : radius_x), | 527 radius_y(radius_y > 0 ? radius_y : radius_x), |
527 force(force), | 528 force(force), |
528 tilt_x(tilt_x), | 529 tilt_x(tilt_x), |
529 tilt_y(tilt_y), | 530 tilt_y(tilt_y), |
530 tangential_pressure(tangential_pressure), | 531 tangential_pressure(tangential_pressure), |
531 twist(twist), | 532 twist(twist), |
532 id(pointer_id) { | 533 id(pointer_id) { |
533 if (pointer_id == PointerDetails::kUnknownPointerId) { | 534 if (pointer_id == PointerDetails::kUnknownPointerId) { |
534 id = pointer_type == EventPointerType::POINTER_TYPE_MOUSE | 535 id = pointer_type == EventPointerType::POINTER_TYPE_MOUSE |
535 ? MouseEvent::kMousePointerId | 536 ? MouseEvent::kMousePointerId |
536 : 0; | 537 : 0; |
537 } | 538 } |
538 } | 539 } |
539 | 540 |
540 PointerDetails::PointerDetails(EventPointerType pointer_type, | 541 PointerDetails::PointerDetails(EventPointerType pointer_type, |
541 const gfx::Vector2d& pointer_offset, | 542 const gfx::Vector2d& pointer_offset, |
542 int pointer_id) | 543 PointerId pointer_id) |
543 : PointerDetails(pointer_type, pointer_id) { | 544 : PointerDetails(pointer_type, pointer_id) { |
544 offset = pointer_offset; | 545 offset = pointer_offset; |
545 } | 546 } |
546 | 547 |
547 PointerDetails::PointerDetails(const PointerDetails& other) | 548 PointerDetails::PointerDetails(const PointerDetails& other) |
548 : pointer_type(other.pointer_type), | 549 : pointer_type(other.pointer_type), |
549 radius_x(other.radius_x), | 550 radius_x(other.radius_x), |
550 radius_y(other.radius_y), | 551 radius_y(other.radius_y), |
551 force(other.force), | 552 force(other.force), |
552 tilt_x(other.tilt_x), | 553 tilt_x(other.tilt_x), |
553 tilt_y(other.tilt_y), | 554 tilt_y(other.tilt_y), |
554 tangential_pressure(other.tangential_pressure), | 555 tangential_pressure(other.tangential_pressure), |
555 twist(other.twist), | 556 twist(other.twist), |
556 id(other.id), | 557 id(other.id), |
557 offset(other.offset) {} | 558 offset(other.offset) {} |
558 | 559 |
559 const int PointerDetails::kUnknownPointerId = -1; | 560 const PointerId PointerDetails::kUnknownPointerId = -1; |
560 | 561 |
561 //////////////////////////////////////////////////////////////////////////////// | 562 //////////////////////////////////////////////////////////////////////////////// |
562 // MouseEvent | 563 // MouseEvent |
563 | 564 |
564 MouseEvent::MouseEvent(const base::NativeEvent& native_event) | 565 MouseEvent::MouseEvent(const base::NativeEvent& native_event) |
565 : LocatedEvent(native_event), | 566 : LocatedEvent(native_event), |
566 changed_button_flags_(GetChangedMouseButtonFlagsFromNative(native_event)), | 567 changed_button_flags_(GetChangedMouseButtonFlagsFromNative(native_event)), |
567 pointer_details_(GetMousePointerDetailsFromNative(native_event)) { | 568 pointer_details_(GetMousePointerDetailsFromNative(native_event)) { |
568 latency()->AddLatencyNumberWithTimestamp( | 569 latency()->AddLatencyNumberWithTimestamp( |
569 INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, 0, | 570 INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, 0, |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
750 f &= ~EF_IS_TRIPLE_CLICK; | 751 f &= ~EF_IS_TRIPLE_CLICK; |
751 break; | 752 break; |
752 case 3: | 753 case 3: |
753 f &= ~EF_IS_DOUBLE_CLICK; | 754 f &= ~EF_IS_DOUBLE_CLICK; |
754 f |= EF_IS_TRIPLE_CLICK; | 755 f |= EF_IS_TRIPLE_CLICK; |
755 break; | 756 break; |
756 } | 757 } |
757 set_flags(f); | 758 set_flags(f); |
758 } | 759 } |
759 | 760 |
760 const int MouseEvent::kMousePointerId = std::numeric_limits<int32_t>::max(); | 761 const PointerId MouseEvent::kMousePointerId = |
| 762 std::numeric_limits<PointerId>::max(); |
761 | 763 |
762 //////////////////////////////////////////////////////////////////////////////// | 764 //////////////////////////////////////////////////////////////////////////////// |
763 // MouseWheelEvent | 765 // MouseWheelEvent |
764 | 766 |
765 MouseWheelEvent::MouseWheelEvent(const base::NativeEvent& native_event) | 767 MouseWheelEvent::MouseWheelEvent(const base::NativeEvent& native_event) |
766 : MouseEvent(native_event), | 768 : MouseEvent(native_event), |
767 offset_(GetMouseWheelOffset(native_event)) { | 769 offset_(GetMouseWheelOffset(native_event)) { |
768 } | 770 } |
769 | 771 |
770 MouseWheelEvent::MouseWheelEvent(const ScrollEvent& scroll_event) | 772 MouseWheelEvent::MouseWheelEvent(const ScrollEvent& scroll_event) |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1446 flags | EF_FROM_TOUCH), | 1448 flags | EF_FROM_TOUCH), |
1447 details_(details), | 1449 details_(details), |
1448 unique_touch_event_id_(unique_touch_event_id) { | 1450 unique_touch_event_id_(unique_touch_event_id) { |
1449 latency()->set_source_event_type(ui::SourceEventType::TOUCH); | 1451 latency()->set_source_event_type(ui::SourceEventType::TOUCH); |
1450 } | 1452 } |
1451 | 1453 |
1452 GestureEvent::~GestureEvent() { | 1454 GestureEvent::~GestureEvent() { |
1453 } | 1455 } |
1454 | 1456 |
1455 } // namespace ui | 1457 } // namespace ui |
OLD | NEW |