GNOME Bugzilla – Bug 749770
Implement kinetic scrolling for libinput-managed devices
Last modified: 2015-05-24 15:02: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.
Created attachment 303857 [details] [review] scrolledwindow: Refactor scroll unit guessing into a separate function Makes it clearer, and will be used in further places.
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.
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.
Seems to work nicely.
Review of attachment 303860 [details] [review]: .
Review of attachment 303857 [details] [review]: sure
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