After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 749770 - Implement kinetic scrolling for libinput-managed devices
Implement kinetic scrolling for libinput-managed devices
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkScrolledWindow
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2015-05-23 14:13 UTC by Carlos Garnacho
Modified: 2015-05-24 15:02 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
scrolledwindow: Refactor scroll unit guessing into a separate function (2.90 KB, patch)
2015-05-23 14:14 UTC, Carlos Garnacho
accepted-commit_now Details | Review
scrolledwindow: Trigger builtin kinetic deceleration on libinput devices (8.10 KB, patch)
2015-05-23 14:14 UTC, Carlos Garnacho
none Details | Review
scrolledwindow: Trigger builtin kinetic deceleration on libinput devices (8.13 KB, patch)
2015-05-23 14:24 UTC, Carlos Garnacho
accepted-commit_now Details | Review

Description Carlos Garnacho 2015-05-23 14:13:55 UTC
Libinput will send a 0/0 scroll event to finish scrolling on the devices it can know about this fact (restricted to touchpads and button-scrolling mode on trackpads/trackballs/mice in general).

We can use this event to bring back kinetic scrolling in scrolledwindow, I'm attaching a couple of patches to do so by reusing the kinetic scroll implementation there, although the calculation of velocities is done separately to GtkGestureSwipe.
Comment 1 Carlos Garnacho 2015-05-23 14:14:48 UTC
Created attachment 303857 [details] [review]
scrolledwindow: Refactor scroll unit guessing into a separate function

Makes it clearer, and will be used in further places.
Comment 2 Carlos Garnacho 2015-05-23 14:14:53 UTC
Created attachment 303858 [details] [review]
scrolledwindow: Trigger builtin kinetic deceleration on libinput devices

The libinput driver will send a 0/0 scroll event on touchpads and other
devices where it knows scrolling stopped for sure. Use these events to
trigger kinetic scrolling from there.

The mechanism is similar to GtkGestureSwipe, we keep a backlog of the
latest dx/dy till a previous point in time, and calculate the final
velocities from there, with the difference we're dealing with scroll
units, and not pixel distances.
Comment 3 Carlos Garnacho 2015-05-23 14:24:34 UTC
Created attachment 303860 [details] [review]
scrolledwindow: Trigger builtin kinetic deceleration on libinput devices

The libinput driver will send a 0/0 scroll event on touchpads and other
devices where it knows scrolling stopped for sure. Use these events to
trigger kinetic scrolling from there.

The mechanism is similar to GtkGestureSwipe, we keep a backlog of the
latest dx/dy till a previous point in time, and calculate the final
velocities from there, with the difference we're dealing with scroll
units, and not pixel distances.
Comment 4 Matthias Clasen 2015-05-23 21:23:40 UTC
Seems to work nicely.
Comment 5 Matthias Clasen 2015-05-24 13:43:42 UTC
Review of attachment 303860 [details] [review]:

.
Comment 6 Matthias Clasen 2015-05-24 13:43:59 UTC
Review of attachment 303857 [details] [review]:

sure
Comment 7 Carlos Garnacho 2015-05-24 15:02:55 UTC
Attachment 303857 [details] pushed as fc28303 - scrolledwindow: Refactor scroll unit guessing into a separate function
Attachment 303860 [details] pushed as 48bfabe - scrolledwindow: Trigger builtin kinetic deceleration on libinput devices