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

Side by Side Diff: ui/chromeos/touch_exploration_controller.h

Issue 333623003: Added split tap to TouchExplorationController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@VLOG
Patch Set: Dominic's changes 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 unified diff | Download patch
OLDNEW
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 #ifndef UI_CHROMEOS_TOUCH_EXPLORATION_CONTROLLER_H_ 5 #ifndef UI_CHROMEOS_TOUCH_EXPLORATION_CONTROLLER_H_
6 #define UI_CHROMEOS_TOUCH_EXPLORATION_CONTROLLER_H_ 6 #define UI_CHROMEOS_TOUCH_EXPLORATION_CONTROLLER_H_
7 7
8 #include "base/timer/timer.h" 8 #include "base/timer/timer.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "ui/chromeos/ui_chromeos_export.h" 10 #include "ui/chromeos/ui_chromeos_export.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 ui::EventRewriteStatus InSingleTapPressed( 98 ui::EventRewriteStatus InSingleTapPressed(
99 const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event); 99 const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event);
100 ui::EventRewriteStatus InSingleTapReleased( 100 ui::EventRewriteStatus InSingleTapReleased(
101 const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event); 101 const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event);
102 ui::EventRewriteStatus InDoubleTapPressed( 102 ui::EventRewriteStatus InDoubleTapPressed(
103 const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event); 103 const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event);
104 ui::EventRewriteStatus InTouchExploration( 104 ui::EventRewriteStatus InTouchExploration(
105 const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event); 105 const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event);
106 ui::EventRewriteStatus InPassthroughMinusOne( 106 ui::EventRewriteStatus InPassthroughMinusOne(
107 const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event); 107 const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event);
108 108 ui::EventRewriteStatus InTouchExplSecondPress(
109 const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event);
109 // This timer is started every time we get the first press event, and 110 // This timer is started every time we get the first press event, and
110 // it fires after the double-click timeout elapses (300 ms by default). 111 // it fires after the double-click timeout elapses (300 ms by default).
111 // If the user taps and releases within 300 ms and doesn't press again, 112 // If the user taps and releases within 300 ms and doesn't press again,
112 // we treat that as a single mouse move (touch exploration) event. 113 // we treat that as a single mouse move (touch exploration) event.
113 void OnTapTimerFired(); 114 void OnTapTimerFired();
114 115
115 // Dispatch a new event outside of the event rewriting flow. 116 // Dispatch a new event outside of the event rewriting flow.
116 void DispatchEvent(ui::Event* event); 117 void DispatchEvent(ui::Event* event);
117 118
118 scoped_ptr<ui::Event> CreateMouseMoveEvent(const gfx::PointF& location, 119 scoped_ptr<ui::Event> CreateMouseMoveEvent(const gfx::PointF& location,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 153
153 // The user placed two or more fingers down within the grace period. 154 // The user placed two or more fingers down within the grace period.
154 // We're now in passthrough mode until all fingers are lifted. Initially 155 // We're now in passthrough mode until all fingers are lifted. Initially
155 // the first finger is ignored and other fingers are passed through 156 // the first finger is ignored and other fingers are passed through
156 // as-is. If a finger other than the initial one is the first to be 157 // as-is. If a finger other than the initial one is the first to be
157 // released, we rewrite the first finger with the touch id of the finger 158 // released, we rewrite the first finger with the touch id of the finger
158 // that was released, from now on. The motivation for this is that if 159 // that was released, from now on. The motivation for this is that if
159 // the user starts a scroll with 2 fingers, they can release either one 160 // the user starts a scroll with 2 fingers, they can release either one
160 // and continue the scrolling. 161 // and continue the scrolling.
161 PASSTHROUGH_MINUS_ONE, 162 PASSTHROUGH_MINUS_ONE,
163
164 // The user was in touch exploration, but has placed down another finger.
165 // If the user releases the second finger, a touch press and release
166 // will go through at the last touch explore location. If the user
167 // releases the touch explore finger, the other finger will continue
168 // with touch explore. Once more than two fingers are pressed, the state
169 // is changed to wait for all fingers to be released before continuing.
aboxhall 2014/06/13 17:06:48 "...wait for all fingers to be released" etc: does
evy 2014/06/13 17:48:59 Oh sorry, this was an old comment from how I used
170 TE_SECOND_PRESS,
162 }; 171 };
163 172
164 void VLOGState(int line_number); 173 void VLOGState(int line_number);
165 174
166 void VLOGEvent(const ui::Event& event, int line_number); 175 void VLOGEvent(const ui::Event& event, int line_number);
167 176
168 // Gets enum name from integer value 177 // Gets enum name from integer value
169 const char* EnumStateToString(State state); 178 const char* EnumStateToString(State state);
170 179
171 const char* EnumEventTypeToString(ui::EventType type); 180 const char* EnumEventTypeToString(ui::EventType type);
(...skipping 13 matching lines...) Expand all
185 int initial_touch_id_passthrough_mapping_; 194 int initial_touch_id_passthrough_mapping_;
186 195
187 // The current state. 196 // The current state.
188 State state_; 197 State state_;
189 198
190 // A copy of the event from the initial touch press. 199 // A copy of the event from the initial touch press.
191 scoped_ptr<ui::TouchEvent> initial_press_; 200 scoped_ptr<ui::TouchEvent> initial_press_;
192 201
193 // The last location where we synthesized a mouse move event. 202 // The last location where we synthesized a mouse move event.
194 // When the user double-taps, we send the passed-through tap here. 203 // When the user double-taps, we send the passed-through tap here.
195 gfx::PointF last_touch_exploration_location_; 204 scoped_ptr<ui::TouchEvent> last_touch_exploration_;
196 205
197 // A timer to fire the mouse move event after the double-tap delay. 206 // A timer to fire the mouse move event after the double-tap delay.
198 base::OneShotTimer<TouchExplorationController> tap_timer_; 207 base::OneShotTimer<TouchExplorationController> tap_timer_;
199 208
200 // For testing only, an event handler to use for generated events 209 // For testing only, an event handler to use for generated events
201 // outside of the normal event rewriting flow. 210 // outside of the normal event rewriting flow.
202 ui::EventHandler* event_handler_for_testing_; 211 ui::EventHandler* event_handler_for_testing_;
203 212
204 // A default gesture detector config, so we can share the same 213 // A default gesture detector config, so we can share the same
205 // timeout and pixel slop constants. 214 // timeout and pixel slop constants.
206 ui::GestureDetector::Config gesture_detector_config_; 215 ui::GestureDetector::Config gesture_detector_config_;
207 216
208 // The previous state entered 217 // The previous state entered
209 State prev_state_; 218 State prev_state_;
210 219
211 // The previous EventType 220 // The previous EventType
212 ui::EventType prev_event_; 221 ui::EventType prev_event_;
213 222
214 DISALLOW_COPY_AND_ASSIGN(TouchExplorationController); 223 DISALLOW_COPY_AND_ASSIGN(TouchExplorationController);
215 }; 224 };
216 225
217 } // namespace ui 226 } // namespace ui
218 227
219 #endif // UI_CHROMEOS_TOUCH_EXPLORATION_CONTROLLER_H_ 228 #endif // UI_CHROMEOS_TOUCH_EXPLORATION_CONTROLLER_H_
OLDNEW
« no previous file with comments | « no previous file | ui/chromeos/touch_exploration_controller.cc » ('j') | ui/chromeos/touch_exploration_controller.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698