Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1002)

Unified Diff: ui/events/gesture_detection/motion_event.h

Issue 1287103004: Sync ui/events to chromium @ https://codereview.chromium.org/1210203002 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rebased Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/events/gesture_detection/motion_event.h
diff --git a/ui/events/gesture_detection/motion_event.h b/ui/events/gesture_detection/motion_event.h
index 2277277aa91812ddb57c0767159817f6541fc07a..12834a793f2db1e51e2af8a621fb98c139bdb32c 100644
--- a/ui/events/gesture_detection/motion_event.h
+++ b/ui/events/gesture_detection/motion_event.h
@@ -46,7 +46,8 @@ class GESTURE_DETECTION_EXPORT MotionEvent {
virtual ~MotionEvent() {}
- virtual int GetId() const = 0;
+ // An unique identifier this motion event.
+ virtual uint32 GetUniqueEventId() const = 0;
virtual Action GetAction() const = 0;
// Only valid if |GetAction()| returns ACTION_POINTER_UP or
// ACTION_POINTER_DOWN.
@@ -76,9 +77,11 @@ class GESTURE_DETECTION_EXPORT MotionEvent {
virtual float GetHistoricalY(size_t pointer_index,
size_t historical_index) const;
- virtual scoped_ptr<MotionEvent> Clone() const = 0;
- virtual scoped_ptr<MotionEvent> Cancel() const = 0;
+ // Get the id of the device which created the event. Currently Aura only.
+ virtual int GetSourceDeviceId(size_t pointer_index) const;
+ // Utility accessor methods for convenience.
+ int GetPointerId() const { return GetPointerId(0); }
float GetX() const { return GetX(0); }
float GetY() const { return GetY(0); }
float GetRawX() const { return GetRawX(0); }
@@ -89,8 +92,11 @@ class GESTURE_DETECTION_EXPORT MotionEvent {
float GetTouchMajor() const { return GetTouchMajor(0); }
float GetTouchMinor() const { return GetTouchMinor(0); }
- // Returns the orientation of the major axis clockwise from vertical, in
- // radians. The return value lies in [-PI/2, PI/2].
+ // Returns the orientation in radians. The meaning is overloaded:
+ // * For a touch screen or pad, it's the orientation of the major axis
+ // clockwise from vertical. The return value lies in [-PI/2, PI/2].
+ // * For a stylus, it indicates the direction in which the stylus is pointing.
+ // The return value lies in [-PI, PI].
float GetOrientation() const { return GetOrientation(0); }
float GetPressure() const { return GetPressure(0); }
@@ -98,12 +104,14 @@ class GESTURE_DETECTION_EXPORT MotionEvent {
// O(N) search of pointers (use sparingly!). Returns -1 if |id| nonexistent.
int FindPointerIndexOfId(int id) const;
-};
-GESTURE_DETECTION_EXPORT bool operator==(const MotionEvent& lhs,
- const MotionEvent& rhs);
-GESTURE_DETECTION_EXPORT bool operator!=(const MotionEvent& lhs,
- const MotionEvent& rhs);
+ // Note that these methods perform shallow copies of the originating events.
+ // They guarantee only that the returned type will reflect the same
+ // data exposed by the MotionEvent interface; no guarantees are made that the
+ // underlying implementation is identical to the source implementation.
+ scoped_ptr<MotionEvent> Clone() const;
+ scoped_ptr<MotionEvent> Cancel() const;
+};
} // namespace ui
« no previous file with comments | « ui/events/gesture_detection/gesture_provider_unittest.cc ('k') | ui/events/gesture_detection/motion_event.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698