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

Unified Diff: ui/chromeos/touch_exploration_controller.cc

Issue 465543003: Modified state flow for touch explore released in touch_exploration_controller. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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/chromeos/touch_exploration_controller.cc
diff --git a/ui/chromeos/touch_exploration_controller.cc b/ui/chromeos/touch_exploration_controller.cc
index 3670f1e948f213908d1884d9f844eacf35916a5c..5ec561bb70dda512e17ee8d89ce847ffd4efd6d3 100644
--- a/ui/chromeos/touch_exploration_controller.cc
+++ b/ui/chromeos/touch_exploration_controller.cc
@@ -239,17 +239,32 @@ TouchExplorationController::InSingleTapOrTouchExploreReleased(
tap_timer_.Stop();
return ui::EVENT_REWRITE_DISCARD;
}
- // This is the second tap in a double-tap (or double tap-hold).
- // We set the tap timer. If it fires before the user lifts their finger,
- // one-finger passthrough begins. Otherwise, there is a touch press and
- // release at the location of the last touch exploration.
- state_ = DOUBLE_TAP_PENDING;
- VLOG_STATE();
- StartTapTimer();
- // This will update as the finger moves before a possible passthrough, and
- // will determine the offset.
- last_unused_finger_event_.reset(new ui::TouchEvent(event));
- return ui::EVENT_REWRITE_DISCARD;
+ if (state_ == SINGLE_TAP_RELEASED) {
+ // This is the second tap in a double-tap (or double tap-hold).
+ // We set the tap timer. If it fires before the user lifts their finger,
+ // one-finger passthrough begins. Otherwise, there is a touch press and
+ // release at the location of the last touch exploration.
+ state_ = DOUBLE_TAP_PENDING;
+ VLOG_STATE();
+ StartTapTimer();
+ // This will update as the finger moves before a possible passthrough, and
+ // will determine the offset.
+ last_unused_finger_event_.reset(new ui::TouchEvent(event));
+ return ui::EVENT_REWRITE_DISCARD;
+ } else if (state_ == TOUCH_EXPLORE_RELEASED) {
+ // This is the initial "press" (location, time, and touch id) of a single
+ // tap click.
+ initial_press_.reset(new ui::TouchEvent(event));
+ rewritten_event->reset(
+ new ui::TouchEvent(ui::ET_TOUCH_PRESSED,
+ last_touch_exploration_->location(),
+ initial_press_->touch_id(),
+ event.time_stamp()));
+ (*rewritten_event)->set_flags(event.flags());
+ state_ = TOUCH_RELEASE_PENDING;
+ VLOG_STATE();
+ return ui::EVENT_REWRITE_REWRITTEN;
+ }
} else if (type == ui::ET_TOUCH_RELEASED && !last_touch_exploration_) {
// If the previous press was discarded, we need to also handle its
// release.

Powered by Google App Engine
This is Rietveld 408576698