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 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 public: | 482 public: |
483 explicit TouchEvent(const base::NativeEvent& native_event); | 483 explicit TouchEvent(const base::NativeEvent& native_event); |
484 | 484 |
485 // Create a new TouchEvent which is identical to the provided model. | 485 // Create a new TouchEvent which is identical to the provided model. |
486 // If source / target windows are provided, the model location will be | 486 // If source / target windows are provided, the model location will be |
487 // converted from |source| coordinate system to |target| coordinate system. | 487 // converted from |source| coordinate system to |target| coordinate system. |
488 template <class T> | 488 template <class T> |
489 TouchEvent(const TouchEvent& model, T* source, T* target) | 489 TouchEvent(const TouchEvent& model, T* source, T* target) |
490 : LocatedEvent(model, source, target), | 490 : LocatedEvent(model, source, target), |
491 touch_id_(model.touch_id_), | 491 touch_id_(model.touch_id_), |
| 492 unique_event_id_(model.unique_event_id_), |
492 radius_x_(model.radius_x_), | 493 radius_x_(model.radius_x_), |
493 radius_y_(model.radius_y_), | 494 radius_y_(model.radius_y_), |
494 rotation_angle_(model.rotation_angle_), | 495 rotation_angle_(model.rotation_angle_), |
495 force_(model.force_) { | 496 force_(model.force_) {} |
496 } | |
497 | 497 |
498 TouchEvent(EventType type, | 498 TouchEvent(EventType type, |
499 const gfx::PointF& location, | 499 const gfx::PointF& location, |
500 int touch_id, | 500 int touch_id, |
501 base::TimeDelta time_stamp); | 501 base::TimeDelta time_stamp); |
502 | 502 |
503 TouchEvent(EventType type, | 503 TouchEvent(EventType type, |
504 const gfx::PointF& location, | 504 const gfx::PointF& location, |
505 int flags, | 505 int flags, |
506 int touch_id, | 506 int touch_id, |
507 base::TimeDelta timestamp, | 507 base::TimeDelta timestamp, |
508 float radius_x, | 508 float radius_x, |
509 float radius_y, | 509 float radius_y, |
510 float angle, | 510 float angle, |
511 float force); | 511 float force); |
512 | 512 |
513 ~TouchEvent() override; | 513 ~TouchEvent() override; |
514 | 514 |
| 515 // The id of the pointer this event modifies. |
515 int touch_id() const { return touch_id_; } | 516 int touch_id() const { return touch_id_; } |
| 517 // A unique identifier for this event. |
| 518 uint64 unique_event_id() const { return unique_event_id_; } |
516 float radius_x() const { return radius_x_; } | 519 float radius_x() const { return radius_x_; } |
517 float radius_y() const { return radius_y_; } | 520 float radius_y() const { return radius_y_; } |
518 float rotation_angle() const { return rotation_angle_; } | 521 float rotation_angle() const { return rotation_angle_; } |
519 float force() const { return force_; } | 522 float force() const { return force_; } |
520 | 523 |
521 // Used for unit tests. | 524 // Used for unit tests. |
522 void set_radius_x(const float r) { radius_x_ = r; } | 525 void set_radius_x(const float r) { radius_x_ = r; } |
523 void set_radius_y(const float r) { radius_y_ = r; } | 526 void set_radius_y(const float r) { radius_y_ = r; } |
524 | 527 |
525 // Overridden from LocatedEvent. | 528 // Overridden from LocatedEvent. |
526 void UpdateForRootTransform( | 529 void UpdateForRootTransform( |
527 const gfx::Transform& inverted_root_transform) override; | 530 const gfx::Transform& inverted_root_transform) override; |
528 | 531 |
| 532 // Marks the event as not participating in synchronous gesture recognition. |
| 533 void DisableSynchronousHandling(); |
| 534 bool synchronous_handling_disabled() const { |
| 535 return !!(result() & ER_DISABLE_SYNC_HANDLING); |
| 536 } |
| 537 |
529 protected: | 538 protected: |
530 void set_radius(float radius_x, float radius_y) { | 539 void set_radius(float radius_x, float radius_y) { |
531 radius_x_ = radius_x; | 540 radius_x_ = radius_x; |
532 radius_y_ = radius_y; | 541 radius_y_ = radius_y; |
533 } | 542 } |
534 | 543 |
535 void set_rotation_angle(float rotation_angle) { | 544 void set_rotation_angle(float rotation_angle) { |
536 rotation_angle_ = rotation_angle; | 545 rotation_angle_ = rotation_angle; |
537 } | 546 } |
538 | 547 |
539 void set_force(float force) { force_ = force; } | 548 void set_force(float force) { force_ = force; } |
540 | 549 |
541 private: | 550 private: |
542 // The identity (typically finger) of the touch starting at 0 and incrementing | 551 // The identity (typically finger) of the touch starting at 0 and incrementing |
543 // for each separable additional touch that the hardware can detect. | 552 // for each separable additional touch that the hardware can detect. |
544 const int touch_id_; | 553 const int touch_id_; |
545 | 554 |
| 555 // A unique identifier for the touch event. |
| 556 const uint64 unique_event_id_; |
| 557 |
546 // Radius of the X (major) axis of the touch ellipse. 0.0 if unknown. | 558 // Radius of the X (major) axis of the touch ellipse. 0.0 if unknown. |
547 float radius_x_; | 559 float radius_x_; |
548 | 560 |
549 // Radius of the Y (minor) axis of the touch ellipse. 0.0 if unknown. | 561 // Radius of the Y (minor) axis of the touch ellipse. 0.0 if unknown. |
550 float radius_y_; | 562 float radius_y_; |
551 | 563 |
552 // Angle of the major axis away from the X axis. Default 0.0. | 564 // Angle of the major axis away from the X axis. Default 0.0. |
553 float rotation_angle_; | 565 float rotation_angle_; |
554 | 566 |
555 // Force (pressure) of the touch. Normalized to be [0, 1]. Default to be 0.0. | 567 // Force (pressure) of the touch. Normalized to be [0, 1]. Default to be 0.0. |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 | 822 |
811 const GestureEventDetails& details() const { return details_; } | 823 const GestureEventDetails& details() const { return details_; } |
812 | 824 |
813 private: | 825 private: |
814 GestureEventDetails details_; | 826 GestureEventDetails details_; |
815 }; | 827 }; |
816 | 828 |
817 } // namespace ui | 829 } // namespace ui |
818 | 830 |
819 #endif // UI_EVENTS_EVENT_H_ | 831 #endif // UI_EVENTS_EVENT_H_ |
OLD | NEW |