Index: ui/events/event.h |
diff --git a/ui/events/event.h b/ui/events/event.h |
index d07fc639222a4b78e672b850b5bf38d452603308..370110f03c8c8769e725f786af50b273976c8826 100644 |
--- a/ui/events/event.h |
+++ b/ui/events/event.h |
@@ -408,10 +408,8 @@ class EVENTS_EXPORT LocatedEvent : public Event { |
// PointerEvents API. |
struct EVENTS_EXPORT PointerDetails { |
public: |
- PointerDetails() {} |
- explicit PointerDetails(EventPointerType pointer_type) |
- : pointer_type(pointer_type), |
- force(std::numeric_limits<float>::quiet_NaN()) {} |
+ PointerDetails(); |
+ explicit PointerDetails(EventPointerType pointer_type, uint32_t id = 0); |
PointerDetails(EventPointerType pointer_type, |
float radius_x, |
float radius_y, |
@@ -419,21 +417,10 @@ struct EVENTS_EXPORT PointerDetails { |
float tilt_x, |
float tilt_y, |
float tangential_pressure = 0.0f, |
- int twist = 0) |
- : pointer_type(pointer_type), |
- // If we aren't provided with a radius on one axis, use the |
- // information from the other axis. |
- radius_x(radius_x > 0 ? radius_x : radius_y), |
- radius_y(radius_y > 0 ? radius_y : radius_x), |
- force(force), |
- tilt_x(tilt_x), |
- tilt_y(tilt_y), |
- tangential_pressure(tangential_pressure), |
- twist(twist) {} |
- PointerDetails(EventPointerType pointer_type, const gfx::Vector2d& offset) |
- : pointer_type(pointer_type), |
- force(std::numeric_limits<float>::quiet_NaN()), |
- offset(offset) {} |
+ int twist = 0, |
+ uint32_t id = 0); |
+ PointerDetails(EventPointerType pointer_type, const gfx::Vector2d& offset); |
+ PointerDetails(const PointerDetails& other); |
bool operator==(const PointerDetails& other) const { |
return pointer_type == other.pointer_type && radius_x == other.radius_x && |
@@ -442,7 +429,7 @@ struct EVENTS_EXPORT PointerDetails { |
(std::isnan(force) && std::isnan(other.force))) && |
tilt_x == other.tilt_x && tilt_y == other.tilt_y && |
tangential_pressure == other.tangential_pressure && |
- twist == other.twist && offset == other.offset; |
+ twist == other.twist && id == other.id && offset == other.offset; |
} |
// The type of pointer device. |
@@ -474,6 +461,9 @@ struct EVENTS_EXPORT PointerDetails { |
// degrees in the range [0,359]. Always 0 if the device does not support it. |
int twist = 0; |
+ // An identifier that uniquely identifies a pointer during its lifetime. |
+ uint32_t id = 0; |
+ |
// Only used by mouse wheel events. The amount to scroll. This is in multiples |
// of kWheelDelta. |
// Note: offset_.x() > 0/offset_.y() > 0 means scroll left/up. |
@@ -663,7 +653,6 @@ class EVENTS_EXPORT TouchEvent : public LocatedEvent { |
template <class T> |
TouchEvent(const TouchEvent& model, T* source, T* target) |
: LocatedEvent(model, source, target), |
- touch_id_(model.touch_id_), |
unique_event_id_(model.unique_event_id_), |
rotation_angle_(model.rotation_angle_), |
may_cause_scrolling_(model.may_cause_scrolling_), |
@@ -672,13 +661,13 @@ class EVENTS_EXPORT TouchEvent : public LocatedEvent { |
TouchEvent(EventType type, |
const gfx::Point& location, |
- int touch_id, |
+ uint32_t touch_id, |
base::TimeTicks time_stamp); |
TouchEvent(EventType type, |
const gfx::Point& location, |
int flags, |
- int touch_id, |
+ uint32_t touch_id, |
base::TimeTicks timestamp, |
float radius_x, |
float radius_y, |
@@ -689,8 +678,6 @@ class EVENTS_EXPORT TouchEvent : public LocatedEvent { |
~TouchEvent() override; |
- // The id of the pointer this event modifies. |
- int touch_id() const { return touch_id_; } |
// A unique identifier for this event. |
uint32_t unique_event_id() const { return unique_event_id_; } |
@@ -725,10 +712,6 @@ class EVENTS_EXPORT TouchEvent : public LocatedEvent { |
// Adjusts rotation_angle_ to within the acceptable range. |
void FixRotationAngle(); |
- // The identity (typically finger) of the touch starting at 0 and incrementing |
- // for each separable additional touch that the hardware can detect. |
- int touch_id_; |
- |
// A unique identifier for the touch event. |
uint32_t unique_event_id_; |
@@ -753,7 +736,7 @@ class EVENTS_EXPORT TouchEvent : public LocatedEvent { |
class EVENTS_EXPORT PointerEvent : public LocatedEvent { |
public: |
- static const int32_t kMousePointerId; |
+ static const uint32_t kMousePointerId; |
// Returns true if a PointerEvent can be constructed from |event|. Currently, |
// only mouse and touch events can be converted to pointer events. |
@@ -767,18 +750,16 @@ class EVENTS_EXPORT PointerEvent : public LocatedEvent { |
const gfx::Point& location, |
const gfx::Point& root_location, |
int flags, |
- int pointer_id, |
+ uint32_t pointer_id, |
int changed_button_flags, |
const PointerDetails& pointer_details, |
base::TimeTicks time_stamp); |
- int32_t pointer_id() const { return pointer_id_; } |
int changed_button_flags() const { return changed_button_flags_; } |
void set_changed_button_flags(int flags) { changed_button_flags_ = flags; } |
const PointerDetails& pointer_details() const { return details_; } |
private: |
- int32_t pointer_id_; |
int changed_button_flags_; |
PointerDetails details_; |
}; |