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 #include "ui/chromeos/touch_exploration_controller.h" | 5 #include "ui/chromeos/touch_exploration_controller.h" |
6 | 6 |
7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
8 #include "ui/aura/client/cursor_client.h" | 8 #include "ui/aura/client/cursor_client.h" |
9 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
10 #include "ui/aura/window_event_dispatcher.h" | 10 #include "ui/aura/window_event_dispatcher.h" |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 TouchExplorationController::InSingleTapOrTouchExploreReleased( | 236 TouchExplorationController::InSingleTapOrTouchExploreReleased( |
237 const ui::TouchEvent& event, | 237 const ui::TouchEvent& event, |
238 scoped_ptr<ui::Event>* rewritten_event) { | 238 scoped_ptr<ui::Event>* rewritten_event) { |
239 const ui::EventType type = event.type(); | 239 const ui::EventType type = event.type(); |
240 // If there is more than one finger down, then discard to wait until only one | 240 // If there is more than one finger down, then discard to wait until only one |
241 // finger is or no fingers are down. | 241 // finger is or no fingers are down. |
242 if (current_touch_ids_.size() > 1) { | 242 if (current_touch_ids_.size() > 1) { |
243 state_ = WAIT_FOR_RELEASE; | 243 state_ = WAIT_FOR_RELEASE; |
244 return ui::EVENT_REWRITE_DISCARD; | 244 return ui::EVENT_REWRITE_DISCARD; |
245 } | 245 } |
246 // If there is no touch exploration yet, discard. | 246 if (type == ui::ET_TOUCH_PRESSED) { |
247 if (!last_touch_exploration_ || type == ui::ET_TOUCH_RELEASED) { | 247 // If there is no touch exploration yet, we can't send a click, so discard. |
248 if (current_touch_ids_.size() == 0) { | 248 if (!last_touch_exploration_) { |
249 ResetToNoFingersDown(); | 249 tap_timer_.Stop(); |
| 250 return ui::EVENT_REWRITE_DISCARD; |
250 } | 251 } |
251 return ui::EVENT_REWRITE_DISCARD; | |
252 } | |
253 | |
254 if (type == ui::ET_TOUCH_PRESSED) { | |
255 // This is the second tap in a double-tap (or double tap-hold). | 252 // This is the second tap in a double-tap (or double tap-hold). |
256 // Rewrite at location of last touch exploration. | 253 // Rewrite at location of last touch exploration. |
257 rewritten_event->reset( | 254 rewritten_event->reset( |
258 new ui::TouchEvent(ui::ET_TOUCH_PRESSED, | 255 new ui::TouchEvent(ui::ET_TOUCH_PRESSED, |
259 last_touch_exploration_->location(), | 256 last_touch_exploration_->location(), |
260 event.touch_id(), | 257 event.touch_id(), |
261 event.time_stamp())); | 258 event.time_stamp())); |
262 (*rewritten_event)->set_flags(event.flags()); | 259 (*rewritten_event)->set_flags(event.flags()); |
263 state_ = DOUBLE_TAP_PRESSED; | 260 state_ = DOUBLE_TAP_PRESSED; |
264 VLOG_STATE(); | 261 VLOG_STATE(); |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
879 return "PASSTHROUGH"; | 876 return "PASSTHROUGH"; |
880 case WAIT_FOR_RELEASE: | 877 case WAIT_FOR_RELEASE: |
881 return "WAIT_FOR_RELEASE"; | 878 return "WAIT_FOR_RELEASE"; |
882 case SLIDE_GESTURE: | 879 case SLIDE_GESTURE: |
883 return "SLIDE_GESTURE"; | 880 return "SLIDE_GESTURE"; |
884 } | 881 } |
885 return "Not a state"; | 882 return "Not a state"; |
886 } | 883 } |
887 | 884 |
888 } // namespace ui | 885 } // namespace ui |
OLD | NEW |