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

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

Issue 348813002: Extend MotionEvent to have tool type and button state (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 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 899aeea1c2ae7b8530cfbb1af15e57824bb2b29d..a1ed7ebad6ab47d71e9e567eb3005bcacd75df7f 100644
--- a/ui/events/gesture_detection/motion_event.h
+++ b/ui/events/gesture_detection/motion_event.h
@@ -16,7 +16,7 @@ namespace ui {
class GESTURE_DETECTION_EXPORT MotionEvent {
public:
enum Action {
- ACTION_DOWN,
+ ACTION_DOWN = 100,
jdduke (slow) 2014/06/20 15:33:25 Any reason for the 100/200?
Changwan Ryu 2014/06/20 21:00:34 No specific reason. I just wanted to assign SOME d
jdduke (slow) 2014/06/20 21:19:41 I see, let's stick with not assigning them specifi
Changwan Ryu 2014/06/20 21:32:01 Done.
ACTION_UP,
ACTION_MOVE,
ACTION_CANCEL,
@@ -24,6 +24,20 @@ class GESTURE_DETECTION_EXPORT MotionEvent {
ACTION_POINTER_UP,
};
+ enum ToolType {
+ TOOL_TYPE_UNKNOWN = 200,
+ TOOL_TYPE_FINGER,
+ TOOL_TYPE_STYLUS,
+ TOOL_TYPE_MOUSE,
+ };
+
+ const static int BUTTON_NONE = 0;
jdduke (slow) 2014/06/20 15:33:25 I would go ahead and use an enum bit mask here, e.
Changwan Ryu 2014/06/20 21:00:34 Done.
+ const static int BUTTON_PRIMARY = 1;
+ const static int BUTTON_SECONDARY = 2;
+ const static int BUTTON_TERTIARY = 4;
+ const static int BUTTON_BACK = 8;
+ const static int BUTTON_FORWARD = 16;
+
// The implementer promises that |GetPointerId()| will never exceed this.
enum { MAX_POINTER_ID = 31 };
@@ -53,6 +67,8 @@ class GESTURE_DETECTION_EXPORT MotionEvent {
size_t historical_index) const = 0;
virtual float GetHistoricalY(size_t pointer_index,
size_t historical_index) const = 0;
+ virtual ToolType GetToolType(size_t pointer_index) const = 0;
+ virtual int GetButtonState() const = 0;
virtual scoped_ptr<MotionEvent> Clone() const = 0;
virtual scoped_ptr<MotionEvent> Cancel() const = 0;

Powered by Google App Engine
This is Rietveld 408576698