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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 float y_offset_; | 981 float y_offset_; |
982 // Unaccelerated offsets. | 982 // Unaccelerated offsets. |
983 float x_offset_ordinal_; | 983 float x_offset_ordinal_; |
984 float y_offset_ordinal_; | 984 float y_offset_ordinal_; |
985 // Number of fingers on the pad. | 985 // Number of fingers on the pad. |
986 int finger_count_; | 986 int finger_count_; |
987 }; | 987 }; |
988 | 988 |
989 class EVENTS_EXPORT GestureEvent : public LocatedEvent { | 989 class EVENTS_EXPORT GestureEvent : public LocatedEvent { |
990 public: | 990 public: |
| 991 // The constructor takes a default unique_touch_id of zero to support many |
| 992 // (80+) existing tests that doesn't care about this id. |
991 GestureEvent(float x, | 993 GestureEvent(float x, |
992 float y, | 994 float y, |
993 int flags, | 995 int flags, |
994 base::TimeTicks time_stamp, | 996 base::TimeTicks time_stamp, |
995 const GestureEventDetails& details); | 997 const GestureEventDetails& details, |
| 998 uint32_t unique_touch_event_id = 0); |
996 | 999 |
997 // Create a new GestureEvent which is identical to the provided model. | 1000 // Create a new GestureEvent which is identical to the provided model. |
998 // If source / target windows are provided, the model location will be | 1001 // If source / target windows are provided, the model location will be |
999 // converted from |source| coordinate system to |target| coordinate system. | 1002 // converted from |source| coordinate system to |target| coordinate system. |
1000 template <typename T> | 1003 template <typename T> |
1001 GestureEvent(const GestureEvent& model, T* source, T* target) | 1004 GestureEvent(const GestureEvent& model, T* source, T* target) |
1002 : LocatedEvent(model, source, target), | 1005 : LocatedEvent(model, source, target), |
1003 details_(model.details_) { | 1006 details_(model.details_) { |
1004 } | 1007 } |
1005 | 1008 |
1006 ~GestureEvent() override; | 1009 ~GestureEvent() override; |
1007 | 1010 |
1008 const GestureEventDetails& details() const { return details_; } | 1011 const GestureEventDetails& details() const { return details_; } |
1009 | 1012 |
| 1013 uint32_t unique_touch_event_id() const { |
| 1014 return unique_touch_event_id_; |
| 1015 } |
| 1016 |
1010 private: | 1017 private: |
1011 GestureEventDetails details_; | 1018 GestureEventDetails details_; |
| 1019 |
| 1020 // The unique id of the touch event that caused the gesture event to be |
| 1021 // dispatched. This field gets a non-zero value only for gestures that are |
| 1022 // released through TouchDispositionGestureFilter::SendGesture. The gesture |
| 1023 // events that aren't fired directly in response to processing a touch-event |
| 1024 // (e.g. timer fired ones), this id is zero. See crbug.com/618738. |
| 1025 uint32_t unique_touch_event_id_; |
1012 }; | 1026 }; |
1013 | 1027 |
1014 } // namespace ui | 1028 } // namespace ui |
1015 | 1029 |
1016 #endif // UI_EVENTS_EVENT_H_ | 1030 #endif // UI_EVENTS_EVENT_H_ |
OLD | NEW |