Bug 456383 - Add inertial scrolling to WheelHandler for touchpad and touchscreen scrolls
Summary: Add inertial scrolling to WheelHandler for touchpad and touchscreen scrolls
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kirigami
Classification: Frameworks and Libraries
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Other Linux
: NOR wishlist
Target Milestone: Not decided
Assignee: Marco Martin
URL:
Keywords: usability
Depends on:
Blocks:
 
Reported: 2022-07-06 07:28 UTC by Andrew Shark
Modified: 2025-08-09 22:27 UTC (History)
20 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.17
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Shark 2022-07-06 07:28:12 UTC
It is impossible to enable kinetic scrolling in KDE with libinput driver in System Settings.

We know that libinput driver does not implement inertial scrolling for touchpads, see https://wayland.freedesktop.org/libinput/doc/latest/faqs.html#kinetic-scrolling-does-not-work. Synaptic's driver "implementation" is just a crutch: it just keeps sending scroll events when you do swipe by fingers. But it does not care what is going on in the desktop, and causes some unfixable bugs.

We need a proper implementation in KDE.

STEPS TO REPRODUCE
1. Go to System Settings, Input Devices, Touchpad.
2. Search for Inertia Scrolling checkbox

OBSERVED RESULT
There is no such checkbox

EXPECTED RESULT
The checkbox should be available.

SOFTWARE/OS VERSIONS
KDE Plasma Version: 5.25.2
KDE Frameworks Version: 5.95.0
Qt Version: 5.15.5
Graphics Platform: Wayland

ADDITIONAL INFORMATION
Bug 443819 (for okular), Bug 403285 (for konsole) - fixes for synaptics' implementation (ignoring ctrl while scroll events are sent).
Comment 1 Nate Graham 2022-07-06 15:44:14 UTC
If you're saying that we in KDE should forcibly inject inertia ourselves at the driver level (like Synaptics did), that's not really possible. On X11, we don't control the part of the stack where it would need to be implemented. On Wayland, we could do it, but our implementation will conflict with toolkits that already do it themselves, so there will be double-inertia all over the place, in addition to creating an endless number of other issues like Bug 443819 and Bug 403285. Imagine those everywhere. It's not really feasible.

The right approach is to implement inertia in toolkits' scrollviews. GTK and Electron already generally do this, and Qt also does for QtQuick-based software. We just need to turn it on, for the most part. There are a few complications, such as the fact that we actually override a lot of the default QtQuick scroll behaviors with something called WheelHandler which lives in Kirigami, so it would need to be implemented there. So I'll move this to Kirigami as the biggest thing that would need to be changed is WheelHandler.

For QtWidgets-based apps, it's largely hopeless, unfortunately. Someone would need to implement inertia in the QtWidgets scrollview, which seems unlikely as widgets are semi-frozen.
Comment 2 Nicolas Fella 2022-07-06 17:25:30 UTC
QScroller can be used to enable kinetic scrolling in QtWidgets apps. It's not a magic switch that enables it out-of-the-box everywhere though
Comment 3 Nate Graham 2022-07-06 17:37:21 UTC
Yes, it would have to be implemented in each of our five hundred million QtWidgets-based scrollviews, which was what led me to my conclusion that it would be "largely hopeless."
Comment 4 elvisvan 2023-03-24 11:30:14 UTC Comment hidden (spam)
Comment 5 kde-yyds 2024-06-25 09:26:46 UTC
I'm pushing commits to https://invent.kde.org/kde-yyds/kirigami-work/-/tree/work-kinetic-scroll
It's still very buggy in some applications at the time. I will open a pull request when it's more usable.
Comment 6 Marco Martin 2025-04-04 14:21:09 UTC
merge request: https://invent.kde.org/frameworks/kirigami/-/merge_requests/1583
Comment 7 Niccolò Venerandi 2025-05-30 09:36:29 UTC
In the works with https://invent.kde.org/frameworks/kirigami/-/merge_requests/1817
Comment 8 Nate Graham 2025-06-26 00:26:45 UTC
Now merged!
Comment 9 kde-yyds 2025-06-26 02:00:46 UTC
I updated kde plasma and built kirigami manually to test it. The problem in systemsettings still exist. And it seems that touchpad scroll is recognized as mouse wheel that triggers smooth scrolling.
Comment 10 Guido 2025-07-16 10:52:21 UTC
With kde framework 6.16 installed, plasma 6.4.3, no intertial scrolling. I tried system information and other kirigami apps.

perating System: Manjaro Linux 
KDE Plasma Version: 6.4.3
KDE Frameworks Version: 6.16.0
Qt Version: 6.9.1
Kernel Version: 6.16.0-rc6-1-MANJARO (64-bit)
Graphics Platform: Wayland
Processors: 8 × 11th Gen Intel® Core™ i5-1135G7 @ 2.40GHz
Memory: 16 GiB of RAM (15.3 GiB usable)
Graphics Processor: Intel® Iris® Xe Graphics
Comment 11 Nils 2025-08-07 17:14:32 UTC
Inertial scrolling is kinda there now, but it only works if you keep your fingers on the trackpad after moving them. The scroll view then continues to scroll for a bit, even though your fingers don't. But if you lift your fingers, the scrolling stops immediately. In some scroll views, this feels worse than before, and really unexpected. It's the opposite of how it's implemented in Firefox, GTK or anywhere really, where it only flings when you lift your fingers, and stops moving when your fingers stop if they are still on the trackpad.
Is the current behaviour intended?

KDE Plasma Version: 6.4.3
KDE Frameworks Version: 6.16.0
Comment 12 Guido 2025-08-07 18:08:16 UTC
(In reply to Nils from comment #11)
> Inertial scrolling is kinda there now, but it only works if you keep your
> fingers on the trackpad after moving them. 
> 
> KDE Plasma Version: 6.4.3
> KDE Frameworks Version: 6.16.0

I hope this can be changed because it doesn't make much sense; in fact, it's counterproductive.
Comment 13 Nate Graham 2025-08-07 18:11:30 UTC
What you're describing sounds like a bug. It's certainly not the intention, and I can't reproduce it myself.

If it's 100% reproducible for you, we'd appreciate a new bug report about it. Thanks!
Comment 14 Guido 2025-08-07 18:56:06 UTC
(In reply to Nate Graham from comment #13)
> What you're describing sounds like a bug. It's certainly not the intention,
> and I can't reproduce it myself.
> 
> If it's 100% reproducible for you, we'd appreciate a new bug report about
> it. Thanks!

I can't reproduce this behaviour either. Kinetic scrolling simply doesn't work at all.
I wouldn't want him to be fooled by the micro-movements of the fingertips that can occur if you suddenly stop scrolling.
Comment 15 Nils 2025-08-08 00:35:01 UTC
(In reply to Nate Graham from comment #13)
> What you're describing sounds like a bug. It's certainly not the intention,
> and I can't reproduce it myself.
> 
> If it's 100% reproducible for you, we'd appreciate a new bug report about
> it. Thanks!

Not sure if I got something wrong, but I had a look at the code of the commit. The inertial scrolling is triggered when wheelEvent->isEndEvent(). wheelEvent is a QWheelEvent, so I had a look at the Qt 6.9 docs. The function "Returns true if this event's phase() is Qt::ScrollEnd.", but turns out "The Qt::ScrollBegin and Qt::ScrollEnd phases are currently supported only on macOS."

Would be astounded if it never worked at all, but it definitely doesn't for me. Will look into this further tomorrow. The behaviour I noticed when keeping the fingers on the trackpad might well not be inertial scrolling. There is a gradual slowdown after the fingers stop, and it feels drastically different to non-kirigami apps, but I can't fling the view a whole lot.
Comment 16 Nils 2025-08-09 21:42:49 UTC
(In reply to Nils from comment #15)
> (In reply to Nate Graham from comment #13)
> > What you're describing sounds like a bug. It's certainly not the intention,
> > and I can't reproduce it myself.
> > 
> > If it's 100% reproducible for you, we'd appreciate a new bug report about
> > it. Thanks!
> 
> Not sure if I got something wrong, but I had a look at the code of the
> commit. The inertial scrolling is triggered when wheelEvent->isEndEvent().
> wheelEvent is a QWheelEvent, so I had a look at the Qt 6.9 docs. The
> function "Returns true if this event's phase() is Qt::ScrollEnd.", but turns
> out "The Qt::ScrollBegin and Qt::ScrollEnd phases are currently supported
> only on macOS."
> 
> Would be astounded if it never worked at all, but it definitely doesn't for
> me. Will look into this further tomorrow. The behaviour I noticed when
> keeping the fingers on the trackpad might well not be inertial scrolling.
> There is a gradual slowdown after the fingers stop, and it feels drastically
> different to non-kirigami apps, but I can't fling the view a whole lot.

After today's updates it works, and I love it! Thanks so much!
Comment 17 Guido 2025-08-09 22:27:17 UTC
> After today's updates it works, and I love it! Thanks so much!

I confirm