Skip to content

WIP: gdk: Interpolate scroll events to screen refresh

Yariv requested to merge yarivb/gtk:gdk-scroll-interpolation into master

Marked WIP because some bugs were found while working on the GDK-3 backport. Will remove the WIP once the fixes are incorporated here as well.

Keep a history of scroll events and use linear interpolation to estimate the position of the input device at frame display time rather than at the original event time. When interpolation is enabled the original input events are not sent to the listeners. Instead, newly synthesized events are sent once per display frame.

With this MR applied scrolling is visibly smoother when using, e.g., an external Apple touchpad (see the attached videos in #2166). In addition it should result in smoother scroll animation on setups with high refresh rate monitors such as those capable of 144Hz or even 240Hz. Furthermore since only a single event is sent per display frame, regardless of the input device event frequency, it has the potential of reducing cpu usage.

The implementation is done in GdkSurface in order to benefit any gtk widget as well as other gdk-based toolkits.

Fixes #2166

Replaces !1106 (closed)

Edited by Yariv

Merge request reports