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

Unified Diff: components/exo/pointer.cc

Issue 2840113002: exo: Replace fling cancel with generic zero distance scroll (Closed)
Patch Set: added another comment Created 3 years, 8 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 e650b4f4ffe35b7732e406cdf59a315515d966a9..3473ae8a7e510d8b8051e81935b3d46d4907bf33 100644
--- a/components/exo/pointer.cc
+++ b/components/exo/pointer.cc
@@ -207,13 +207,28 @@ 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 wayland, we do not
reveman 2017/05/03 21:02:49 nit: we shouldn't be referring to wayland in this
+ // 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) {
+ // Since wayland does not have support for fling cancel events
reveman 2017/05/03 21:02:48 nit: s/wayland/delegate/
+ // (which are supposed to stop any kind of fling/kinetic scrolling
+ // motion), we emulate this 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 +242,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