| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_GESTURE_DETECTION_UI_MOTION_EVENT_H_ | 5 #ifndef UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_H_ |
| 6 #define UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_H_ | 6 #define UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 virtual float GetX(size_t pointer_index) const OVERRIDE; | 32 virtual float GetX(size_t pointer_index) const OVERRIDE; |
| 33 virtual float GetY(size_t pointer_index) const OVERRIDE; | 33 virtual float GetY(size_t pointer_index) const OVERRIDE; |
| 34 virtual float GetRawX(size_t pointer_index) const OVERRIDE; | 34 virtual float GetRawX(size_t pointer_index) const OVERRIDE; |
| 35 virtual float GetRawY(size_t pointer_index) const OVERRIDE; | 35 virtual float GetRawY(size_t pointer_index) const OVERRIDE; |
| 36 virtual float GetTouchMajor(size_t pointer_index) const OVERRIDE; | 36 virtual float GetTouchMajor(size_t pointer_index) const OVERRIDE; |
| 37 virtual float GetTouchMinor(size_t pointer_index) const OVERRIDE; | 37 virtual float GetTouchMinor(size_t pointer_index) const OVERRIDE; |
| 38 virtual float GetOrientation(size_t pointer_index) const OVERRIDE; | 38 virtual float GetOrientation(size_t pointer_index) const OVERRIDE; |
| 39 virtual float GetPressure(size_t pointer_index) const OVERRIDE; | 39 virtual float GetPressure(size_t pointer_index) const OVERRIDE; |
| 40 virtual ToolType GetToolType(size_t pointer_index) const OVERRIDE; | 40 virtual ToolType GetToolType(size_t pointer_index) const OVERRIDE; |
| 41 virtual int GetButtonState() const OVERRIDE; | 41 virtual int GetButtonState() const OVERRIDE; |
| 42 virtual int GetFlags() const OVERRIDE; |
| 42 virtual base::TimeTicks GetEventTime() const OVERRIDE; | 43 virtual base::TimeTicks GetEventTime() const OVERRIDE; |
| 43 | 44 |
| 44 virtual scoped_ptr<MotionEvent> Clone() const OVERRIDE; | 45 virtual scoped_ptr<MotionEvent> Clone() const OVERRIDE; |
| 45 virtual scoped_ptr<MotionEvent> Cancel() const OVERRIDE; | 46 virtual scoped_ptr<MotionEvent> Cancel() const OVERRIDE; |
| 46 | 47 |
| 47 int GetSourceDeviceId(size_t pointer_index) const; | 48 int GetSourceDeviceId(size_t pointer_index) const; |
| 48 | 49 |
| 49 // We can't cleanup removed touch points immediately upon receipt of a | 50 // We can't cleanup removed touch points immediately upon receipt of a |
| 50 // TouchCancel or TouchRelease, as the MotionEvent needs to be able to report | 51 // TouchCancel or TouchRelease, as the MotionEvent needs to be able to report |
| 51 // information about those touch events. Once the MotionEvent has been | 52 // information about those touch events. Once the MotionEvent has been |
| (...skipping 14 matching lines...) Expand all Loading... |
| 66 float touch_major; | 67 float touch_major; |
| 67 float touch_minor; | 68 float touch_minor; |
| 68 float orientation; | 69 float orientation; |
| 69 }; | 70 }; |
| 70 | 71 |
| 71 MotionEventAura( | 72 MotionEventAura( |
| 72 size_t pointer_count, | 73 size_t pointer_count, |
| 73 const base::TimeTicks& last_touch_time, | 74 const base::TimeTicks& last_touch_time, |
| 74 Action cached_action, | 75 Action cached_action, |
| 75 int cached_action_index, | 76 int cached_action_index, |
| 77 int flags, |
| 76 const PointData (&active_touches)[MotionEvent::MAX_TOUCH_POINT_COUNT]); | 78 const PointData (&active_touches)[MotionEvent::MAX_TOUCH_POINT_COUNT]); |
| 77 | 79 |
| 78 static PointData GetPointDataFromTouchEvent(const TouchEvent& touch); | 80 static PointData GetPointDataFromTouchEvent(const TouchEvent& touch); |
| 79 void AddTouch(const TouchEvent& touch); | 81 void AddTouch(const TouchEvent& touch); |
| 80 void UpdateTouch(const TouchEvent& touch); | 82 void UpdateTouch(const TouchEvent& touch); |
| 81 void UpdateCachedAction(const TouchEvent& touch); | 83 void UpdateCachedAction(const TouchEvent& touch); |
| 82 size_t GetIndexFromId(int id) const; | 84 size_t GetIndexFromId(int id) const; |
| 83 | 85 |
| 84 size_t pointer_count_; | 86 size_t pointer_count_; |
| 85 base::TimeTicks last_touch_time_; | 87 base::TimeTicks last_touch_time_; |
| 86 Action cached_action_; | 88 Action cached_action_; |
| 87 // The index of the touch responsible for last ACTION_POINTER_DOWN or | 89 // The index of the touch responsible for last ACTION_POINTER_DOWN or |
| 88 // ACTION_POINTER_UP. -1 if no such action has occurred. | 90 // ACTION_POINTER_UP. -1 if no such action has occurred. |
| 89 int cached_action_index_; | 91 int cached_action_index_; |
| 92 int flags_; |
| 90 | 93 |
| 91 // We want constant time indexing by pointer_index, and fast indexing by id. | 94 // We want constant time indexing by pointer_index, and fast indexing by id. |
| 92 PointData active_touches_[MotionEvent::MAX_TOUCH_POINT_COUNT]; | 95 PointData active_touches_[MotionEvent::MAX_TOUCH_POINT_COUNT]; |
| 93 | 96 |
| 94 DISALLOW_COPY_AND_ASSIGN(MotionEventAura); | 97 DISALLOW_COPY_AND_ASSIGN(MotionEventAura); |
| 95 }; | 98 }; |
| 96 | 99 |
| 97 } // namespace ui | 100 } // namespace ui |
| 98 | 101 |
| 99 #endif // UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_H_ | 102 #endif // UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_H_ |
| OLD | NEW |