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

Side by Side Diff: components/exo/pointer.cc

Issue 2881333002: exo: Replace fling cancel with generic zero distance scroll (Closed)
Patch Set: Created 3 years, 7 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 | « components/exo/pointer.h ('k') | components/exo/pointer_delegate.h » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/exo/pointer.h" 5 #include "components/exo/pointer.h"
6 6
7 #include "ash/public/cpp/shell_window_ids.h" 7 #include "ash/public/cpp/shell_window_ids.h"
8 #include "cc/output/copy_output_request.h" 8 #include "cc/output/copy_output_request.h"
9 #include "cc/output/copy_output_result.h" 9 #include "cc/output/copy_output_result.h"
10 #include "components/exo/pointer_delegate.h" 10 #include "components/exo/pointer_delegate.h"
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 break; 199 break;
200 } 200 }
201 case ui::ET_MOUSEWHEEL: { 201 case ui::ET_MOUSEWHEEL: {
202 delegate_->OnPointerScroll( 202 delegate_->OnPointerScroll(
203 event->time_stamp(), 203 event->time_stamp(),
204 static_cast<ui::MouseWheelEvent*>(event)->offset(), true); 204 static_cast<ui::MouseWheelEvent*>(event)->offset(), true);
205 delegate_->OnPointerFrame(); 205 delegate_->OnPointerFrame();
206 break; 206 break;
207 } 207 }
208 case ui::ET_SCROLL_FLING_START: { 208 case ui::ET_SCROLL_FLING_START: {
209 // Fling start in chrome signals the lifting of fingers after scrolling.
210 // In wayland terms this signals the end of a scroll sequence.
209 delegate_->OnPointerScrollStop(event->time_stamp()); 211 delegate_->OnPointerScrollStop(event->time_stamp());
210 delegate_->OnPointerFrame(); 212 delegate_->OnPointerFrame();
211 break; 213 break;
212 } 214 }
213 case ui::ET_SCROLL_FLING_CANCEL: { 215 case ui::ET_SCROLL_FLING_CANCEL: {
214 delegate_->OnPointerScrollCancel(event->time_stamp()); 216 // Fling cancel is generated very generously at every touch of the
215 delegate_->OnPointerFrame(); 217 // touchpad. Since it's not directly supported by the delegate, we do not
218 // want limit this event to only right after a fling start has been
219 // generated to prevent erronous behavior.
220 if (last_event_type_ == ui::ET_SCROLL_FLING_START) {
221 // We emulate fling cancel by starting a new scroll sequence that
222 // scrolls by 0 pixels, effectively stopping any kinetic scroll motion.
223 delegate_->OnPointerScroll(event->time_stamp(), gfx::Vector2dF(),
224 false);
225 delegate_->OnPointerFrame();
226 delegate_->OnPointerScrollStop(event->time_stamp());
227 delegate_->OnPointerFrame();
228 }
216 break; 229 break;
217 } 230 }
218 case ui::ET_MOUSE_MOVED: 231 case ui::ET_MOUSE_MOVED:
219 case ui::ET_MOUSE_DRAGGED: 232 case ui::ET_MOUSE_DRAGGED:
220 case ui::ET_MOUSE_ENTERED: 233 case ui::ET_MOUSE_ENTERED:
221 case ui::ET_MOUSE_EXITED: 234 case ui::ET_MOUSE_EXITED:
222 case ui::ET_MOUSE_CAPTURE_CHANGED: 235 case ui::ET_MOUSE_CAPTURE_CHANGED:
223 break; 236 break;
224 default: 237 default:
225 NOTREACHED(); 238 NOTREACHED();
226 break; 239 break;
227 } 240 }
228 241
242 last_event_type_ = event->type();
229 UpdateCursorScale(); 243 UpdateCursorScale();
230 } 244 }
231 245
232 void Pointer::OnScrollEvent(ui::ScrollEvent* event) { 246 void Pointer::OnScrollEvent(ui::ScrollEvent* event) {
233 OnMouseEvent(event); 247 OnMouseEvent(event);
234 } 248 }
235 249
236 //////////////////////////////////////////////////////////////////////////////// 250 ////////////////////////////////////////////////////////////////////////////////
237 // WMHelper::CursorObserver overrides: 251 // WMHelper::CursorObserver overrides:
238 252
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 if (!root_window) 395 if (!root_window)
382 return; 396 return;
383 397
384 aura::client::CursorClient* cursor_client = 398 aura::client::CursorClient* cursor_client =
385 aura::client::GetCursorClient(root_window); 399 aura::client::GetCursorClient(root_window);
386 if (cursor_client) 400 if (cursor_client)
387 cursor_client->SetCursor(cursor_); 401 cursor_client->SetCursor(cursor_);
388 } 402 }
389 403
390 } // namespace exo 404 } // namespace exo
OLDNEW
« no previous file with comments | « components/exo/pointer.h ('k') | components/exo/pointer_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698