diff options
author | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-27 17:25:52 +0000 |
---|---|---|
committer | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-27 17:25:52 +0000 |
commit | 58bbb201e005be5bc97366e88ef29654ef448d08 (patch) | |
tree | d0943b6eeaaff07120f58433bcb5761210422b8a /ui/base/gestures/gesture_sequence.cc | |
parent | c1ff7525842fbb2a22781691611cca5ca2d21eb1 (diff) | |
download | chromium_src-58bbb201e005be5bc97366e88ef29654ef448d08.zip chromium_src-58bbb201e005be5bc97366e88ef29654ef448d08.tar.gz chromium_src-58bbb201e005be5bc97366e88ef29654ef448d08.tar.bz2 |
events: Clean up dispatching code for touch-events.
Unlike all other events, touch-events can be processed asynchronously, and
this complicates using the same code-path used for other events for touch
events. This change adds a generic EventResult::ER_ASYNC for these cases,
and updates the code in events, aura and gesture recognizer to use EventResult
instead of TouchStatus.
The code in views still uses TouchStatus. But it will be cleaned up.
BUG=none
Review URL: https://codereview.chromium.org/10964051
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@159059 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/base/gestures/gesture_sequence.cc')
-rw-r--r-- | ui/base/gestures/gesture_sequence.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/ui/base/gestures/gesture_sequence.cc b/ui/base/gestures/gesture_sequence.cc index e56bfca..7105aa9 100644 --- a/ui/base/gestures/gesture_sequence.cc +++ b/ui/base/gestures/gesture_sequence.cc @@ -30,7 +30,7 @@ enum TouchState { TS_UNKNOWN, }; -// ui::TouchStatus is mapped to TouchStatusInternal to simply indicate whether a +// ui::EventResult is mapped to TouchStatusInternal to simply indicate whether a // processed touch-event should affect gesture-recognition or not. enum TouchStatusInternal { TSI_NOT_PROCESSED, // The touch-event should take-part into @@ -307,11 +307,10 @@ GestureSequence::~GestureSequence() { GestureSequence::Gestures* GestureSequence::ProcessTouchEventForGesture( const TouchEvent& event, - ui::TouchStatus status) { + EventResult result) { StopLongPressTimerIfRequired(event); last_touch_location_ = event.location(); - if (status == ui::TOUCH_STATUS_QUEUED || - status == ui::TOUCH_STATUS_QUEUED_END) + if (result & ER_ASYNC) return NULL; // Set a limit on the number of simultaneous touches in a gesture. @@ -351,7 +350,8 @@ GestureSequence::Gestures* GestureSequence::ProcessTouchEventForGesture( if (event.type() == ui::ET_TOUCH_PRESSED) AppendBeginGestureEvent(point, gestures.get()); - TouchStatusInternal status_internal = (status == ui::TOUCH_STATUS_UNKNOWN) ? + CHECK_NE(ER_ASYNC, result); + TouchStatusInternal status_internal = (result == ER_UNHANDLED) ? TSI_NOT_PROCESSED : TSI_PROCESSED; EdgeStateSignatureType signature = Signature(state_, point_id, @@ -577,7 +577,7 @@ bool GestureSequence::IsSecondTouchDownCloseEnoughForTwoFingerTap() { gfx::Point p1 = GetPointByPointId(0)->last_touch_position(); gfx::Point p2 = GetPointByPointId(1)->last_touch_position(); double max_distance = - ui::GestureConfiguration::max_distance_for_two_finger_tap_in_pixels(); + GestureConfiguration::max_distance_for_two_finger_tap_in_pixels(); double distance = (p1.x() - p2.x()) * (p1.x() - p2.x()) + (p1.y() - p2.y()) * (p1.y() - p2.y()); if (distance < max_distance * max_distance) |