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

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: Changes from James 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
« no previous file with comments | « no previous file | ui/chromeos/touch_exploration_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 // 53 //
54 // If the user taps and releases their finger, after 300 ms from the initial 54 // If the user taps and releases their finger, after 300 ms from the initial
55 // touch, a single mouse move is fired. 55 // touch, a single mouse move is fired.
56 // 56 //
57 // If the user double-taps, the second tap is passed through, allowing the 57 // If the user double-taps, the second tap is passed through, allowing the
58 // user to click - however, the double-tap location is changed to the location 58 // user to click - however, the double-tap location is changed to the location
59 // of the last successful touch exploration - that allows the user to explore 59 // of the last successful touch exploration - that allows the user to explore
60 // anywhere on the screen, hear its description, then double-tap anywhere 60 // anywhere on the screen, hear its description, then double-tap anywhere
61 // to activate it. 61 // to activate it.
62 // 62 //
63 // If the user enters touch exploration mode, they can click without lifting
64 // their touch exploration finger by tapping anywhere else on the screen with
65 // a second finger, while the touch exploration finger is still pressed.
66 //
63 // If the user adds a second finger during the grace period, they enter 67 // If the user adds a second finger during the grace period, they enter
64 // passthrough mode. In this mode, the first finger is ignored but all 68 // passthrough mode. In this mode, the first finger is ignored but all
65 // additional touch events are mostly passed through unmodified. So a 69 // additional touch events are mostly passed through unmodified. So a
66 // two-finger scroll gets passed through as a one-finger scroll. However, 70 // two-finger scroll gets passed through as a one-finger scroll. However,
67 // once in passthrough mode, if one finger is released, the remaining fingers 71 // once in passthrough mode, if one finger is released, the remaining fingers
68 // continue to pass through events, allowing the user to start a scroll 72 // continue to pass through events, allowing the user to start a scroll
69 // with two fingers but finish it with one. Sometimes this requires rewriting 73 // with two fingers but finish it with one. Sometimes this requires rewriting
70 // the touch ids. 74 // the touch ids.
71 // 75 //
72 // Once either touch exploration or passthrough mode has been activated, 76 // Once either touch exploration or passthrough mode has been activated,
(...skipping 25 matching lines...) Expand all
98 ui::EventRewriteStatus InSingleTapPressed( 102 ui::EventRewriteStatus InSingleTapPressed(
99 const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event); 103 const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event);
100 ui::EventRewriteStatus InSingleTapReleased( 104 ui::EventRewriteStatus InSingleTapReleased(
101 const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event); 105 const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event);
102 ui::EventRewriteStatus InDoubleTapPressed( 106 ui::EventRewriteStatus InDoubleTapPressed(
103 const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event); 107 const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event);
104 ui::EventRewriteStatus InTouchExploration( 108 ui::EventRewriteStatus InTouchExploration(
105 const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event); 109 const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event);
106 ui::EventRewriteStatus InPassthroughMinusOne( 110 ui::EventRewriteStatus InPassthroughMinusOne(
107 const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event); 111 const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event);
108 112 ui::EventRewriteStatus InTouchExploreSecondPress(
113 const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event);
109 // This timer is started every time we get the first press event, and 114 // 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). 115 // 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, 116 // 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. 117 // we treat that as a single mouse move (touch exploration) event.
113 void OnTapTimerFired(); 118 void OnTapTimerFired();
114 119
115 // Dispatch a new event outside of the event rewriting flow. 120 // Dispatch a new event outside of the event rewriting flow.
116 void DispatchEvent(ui::Event* event); 121 void DispatchEvent(ui::Event* event);
117 122
118 scoped_ptr<ui::Event> CreateMouseMoveEvent(const gfx::PointF& location, 123 scoped_ptr<ui::Event> CreateMouseMoveEvent(const gfx::PointF& location,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 157
153 // The user placed two or more fingers down within the grace period. 158 // 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 159 // We're now in passthrough mode until all fingers are lifted. Initially
155 // the first finger is ignored and other fingers are passed through 160 // 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 161 // 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 162 // 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 163 // 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 164 // the user starts a scroll with 2 fingers, they can release either one
160 // and continue the scrolling. 165 // and continue the scrolling.
161 PASSTHROUGH_MINUS_ONE, 166 PASSTHROUGH_MINUS_ONE,
167
168 // The user was in touch exploration, but has placed down another finger.
169 // If the user releases the second finger, a touch press and release
170 // will go through at the last touch explore location. If the user
171 // releases the touch explore finger, the other finger will continue with
172 // touch explore. Any fingers pressed past the first two are ignored.
173 TOUCH_EXPLORE_SECOND_PRESS,
162 }; 174 };
163 175
164 void VlogState(const char* function_name); 176 void VlogState(const char* function_name);
165 177
166 void VlogEvent(const ui::TouchEvent& event, const char* function_name); 178 void VlogEvent(const ui::TouchEvent& event, const char* function_name);
167 179
168 // Gets enum name from integer value. 180 // Gets enum name from integer value.
169 const char* EnumStateToString(State state); 181 const char* EnumStateToString(State state);
170 182
171 std::string EnumEventTypeToString(ui::EventType type); 183 std::string EnumEventTypeToString(ui::EventType type);
(...skipping 11 matching lines...) Expand all
183 // initial finger are discarded. If kTouchIdNone, the initial finger 195 // initial finger are discarded. If kTouchIdNone, the initial finger
184 // has been released and no more rewriting will be done. 196 // has been released and no more rewriting will be done.
185 int initial_touch_id_passthrough_mapping_; 197 int initial_touch_id_passthrough_mapping_;
186 198
187 // The current state. 199 // The current state.
188 State state_; 200 State state_;
189 201
190 // A copy of the event from the initial touch press. 202 // A copy of the event from the initial touch press.
191 scoped_ptr<ui::TouchEvent> initial_press_; 203 scoped_ptr<ui::TouchEvent> initial_press_;
192 204
193 // The last location where we synthesized a mouse move event. 205 // The last synthesized mouse move event. When the user double-taps,
194 // When the user double-taps, we send the passed-through tap here. 206 // we send the passed-through tap to the location of this event.
195 gfx::PointF last_touch_exploration_location_; 207 scoped_ptr<ui::TouchEvent> last_touch_exploration_;
196 208
197 // A timer to fire the mouse move event after the double-tap delay. 209 // A timer to fire the mouse move event after the double-tap delay.
198 base::OneShotTimer<TouchExplorationController> tap_timer_; 210 base::OneShotTimer<TouchExplorationController> tap_timer_;
199 211
200 // For testing only, an event handler to use for generated events 212 // For testing only, an event handler to use for generated events
201 // outside of the normal event rewriting flow. 213 // outside of the normal event rewriting flow.
202 ui::EventHandler* event_handler_for_testing_; 214 ui::EventHandler* event_handler_for_testing_;
203 215
204 // A default gesture detector config, so we can share the same 216 // A default gesture detector config, so we can share the same
205 // timeout and pixel slop constants. 217 // timeout and pixel slop constants.
206 ui::GestureDetector::Config gesture_detector_config_; 218 ui::GestureDetector::Config gesture_detector_config_;
207 219
208 // The previous state entered. 220 // The previous state entered.
209 State prev_state_; 221 State prev_state_;
210 222
211 // A copy of the previous event passed. 223 // A copy of the previous event passed.
212 scoped_ptr<ui::TouchEvent> prev_event_; 224 scoped_ptr<ui::TouchEvent> prev_event_;
213 225
214 DISALLOW_COPY_AND_ASSIGN(TouchExplorationController); 226 DISALLOW_COPY_AND_ASSIGN(TouchExplorationController);
215 }; 227 };
216 228
217 } // namespace ui 229 } // namespace ui
218 230
219 #endif // UI_CHROMEOS_TOUCH_EXPLORATION_CONTROLLER_H_ 231 #endif // UI_CHROMEOS_TOUCH_EXPLORATION_CONTROLLER_H_
OLDNEW
« no previous file with comments | « no previous file | ui/chromeos/touch_exploration_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698