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

Unified Diff: components/exo/pointer.cc

Issue 2840113002: exo: Replace fling cancel with generic zero distance scroll (Closed)
Patch Set: fixed nit in test 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/exo/pointer.h ('k') | components/exo/pointer_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/exo/pointer.cc
diff --git a/components/exo/pointer.cc b/components/exo/pointer.cc
index fe25e944589c979ca614ba3fbbd30170ab05c15f..f81ebbe5f84c156d87b14aba0cd391fd1f428922 100644
--- a/components/exo/pointer.cc
+++ b/components/exo/pointer.cc
@@ -207,13 +207,26 @@ void Pointer::OnMouseEvent(ui::MouseEvent* event) {
break;
}
case ui::ET_SCROLL_FLING_START: {
+ // Fling start in chrome signals the lifting of fingers after scrolling.
+ // In wayland terms this signals the end of a scroll sequence.
delegate_->OnPointerScrollStop(event->time_stamp());
delegate_->OnPointerFrame();
break;
}
case ui::ET_SCROLL_FLING_CANCEL: {
- delegate_->OnPointerScrollCancel(event->time_stamp());
- delegate_->OnPointerFrame();
+ // Fling cancel is generated very generously at every touch of the
+ // touchpad. Since it's not directly supported by the delegate, we do not
+ // want limit this event to only right after a fling start has been
+ // generated to prevent erronous behavior.
+ if (last_event_type_ == ui::ET_SCROLL_FLING_START) {
+ // We emulate fling cancel by starting a new scroll sequence that
+ // scrolls by 0 pixels, effectively stopping any kinetic scroll motion.
+ delegate_->OnPointerScroll(event->time_stamp(), gfx::Vector2dF(),
+ false);
+ delegate_->OnPointerFrame();
+ delegate_->OnPointerScrollStop(event->time_stamp());
+ delegate_->OnPointerFrame();
+ }
break;
}
case ui::ET_MOUSE_MOVED:
@@ -227,6 +240,7 @@ void Pointer::OnMouseEvent(ui::MouseEvent* event) {
break;
}
+ last_event_type_ = event->type();
UpdateCursorScale();
}
« 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