Chromium Code Reviews| 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(); |
| } |