[GTK3, GTK4] Animation based on touchpad gestures is jittery
This is a sub-issue of #2025, concerned only with touchpad gestures - GdkEvent
type GDK_TOUCHPAD_SWIPE
and GDK_TOUCHPAD_PINCH
.
The issue
Touchpad swipe and pinch are jittery. The issue was observed when using an external Apple touchpad along with a standard 60Hz monitor.
Steps to reproduce
I am using a first-generation Apple external 'Trackpad'. This was done on a desktop computer with an Intel 'Skylake' CPU and integrated GPU. The same issue was observed when using a discreet AMD GPU. The issue can manifest on any setup - it is actually a matter of input rate vs display rate, see the parent issue (#2025) for details.
- Run gtk3-demo (or gtk4-demo)
- Open the "Gestures" applet
- Use the touchpad to initiate a 2-fingers pinch gesture and move the square around
Current behavior
The movement, scale and rotation of the square are jittery.
Expected outcome
The movement, scale and rotation of the square should be smooth.
Version information
The desktop environment is GNOME Shell (v3.28.4) Wayland session on Ubuntu 18.04. The same issue exists on GTK4 (built from source) as well as the latest version of GTK v3.24 when building from source.
Additional information
To watch the sessions please save each video to your computer and view it locally using mpv (due to some reason GNOME's totem doesn't resize to video). If you view the recordings online, or with a video player incapable of displaying 60FPS, you might not be able to see the differences. Alternatively try to watch the videos in a full-screen mode.
To observe the issue try to follow the sides of the rectangle with your eyes while it moves.
The 'before' video is the current situation, which is relatively jittery. The 'after' video was taken after applying !1562, which solves this problem by interpolating the input events. Both videos were taken by using the 'gestures' demo of the gtk3-demo.
Pinch before: pinch_jitter
Pinch after: pinch_smooth
The root cause
For explanation of the root cause please refer to the parent issue, see here #2025
Fixed by !1562