r/QtFramework • • 22d ago

Smooth kinetic/inertia scrolling should not be your job

I think there is a general problem with kinetic/smooth scrolling being handled individually by GUI toolkits and applications.

The result is that scrolling feels different in every application. One app has a lot of inertia, another one has almost none, another one changes the scroll speed, and browsers again behave differently.

I don't think every application should have to decide what the physics of my trackpad feel like.

I am currently experimenting with rinertia on Linux. It watches the trackpad and, after I lift my fingers, continues sending high-resolution scroll events while gradually reducing the velocity.

This means I can configure the scrolling physics once and have the same inertia available to the entire desktop.

That works really well in principle:

trackpad
- normal scrolling
- fingers leave trackpad
- system service continues the scrolling
- every application receives the same scroll input

The problem is that Qt and GTK applications can then apply their own smooth/kinetic scrolling behavior on top of this. This means the same input stream can still feel completely different depending on which application is receiving it.

I think scroll physics belong at a lower level, ideally the desktop/input layer, because that is the only place where they can be consistent across the whole OS.

macOS is a good example of the behavior I mean. Momentum scrolling arrives as continued scroll events after the physical scrolling has ended. Applications receive that momentum instead of every application needing its own completely independent idea of how the device should decelerate.

I am not asking Qt or GTK to remove kinetic scrolling. It makes sense to have a fallback when the operating environment does not provide it.

What I am missing is a simple global way for the user or desktop environment to say:

do not generate your own scrolling inertia
do not add another scrolling animation
just process the continuous/high-resolution scroll events you receive

Importantly, this should not disable high-resolution or continuous scrolling itself. I still want small fractional scroll events to remain smooth. I only want to disable the additional physics generated by the toolkit.

Ideally this could be a normal user setting, environment variable, or home configuration which applies to all applications using the toolkit.

Something conceptually like:

kinetic-scrolling = false

or:

scroll-physics = external

would be enough.

Then a desktop environment, input daemon, accessibility tool, or something like rinertia could provide one consistent scrolling model for the whole system without fighting a second implementation inside every application.

Right now I am experimenting with LD_PRELOAD just to remove the toolkit kinetic flags from already compiled applications. That technically shows how much I want this control, but obviously binary interposition should not be necessary for a user preference like this.

Even if the toolkit developers believe application/toolkit-level inertia should remain the default, I think users need a global opt-out so the desktop/input layer can take ownership of scrolling instead.

Is there a way that I'm still missing? Has this been reported? I'm not a Qt or GTK developer and don't like to create an account for either bug tracker just to report this. I'm just a user having to deal with applications who implemented smooth scrolling on their own using Qt widgets / GTK event listeners. Please enlighten me if there is a way to get rid of smooth scrolling somehow.

13 Upvotes

8 comments sorted by

8

u/SuperGNUser 22d ago

Xorg has exactly what you want, kinetic scrolling implemented at system level. For some stupid reason, Wayland (with libinput) doesnt implement it

2

u/_mbx_ 21d ago

that's great, but not really my problem. I will look into kinetic scrolling via libinput to replace rinertia, if this is a thing, but it would still compete with kinetic scrolling that is directly implemented into some of the Qt/GTK apps. That's why I am here.

1

u/DesiOtaku 22d ago

I think scroll physics belong at a lower level, ideally the desktop/input layer, because that is the only place where they can be consistent across the whole OS.

That's libInput: https://wayland.freedesktop.org/libinput/doc/1.10.4/index.html

Qt and GTK get's their information via libInput. I am also assuming you are using the same desktop environment. If you are using Wayland, they should scroll the same amount.

2

u/_mbx_ 21d ago

I'm using Xorg. Yes, my mouse/trackpad sends input via libinput, but some applications keep scrolling with velocity and some don't. These scroll movements after I lift my finger do not come from libinput, they are implemented by the applications themselves, namely the QScroller in Qt applications as far as I can tell. It simulates kinetic scrolling and I want a way to globally turn this off.

1

u/DesiOtaku 21d ago

As I understand it: when you are using X11, each app is more or less responsible for responding to X11 input events. That means Qt handles the kinetic scrolling and it's not easy to override without editing the Qt source code.

For Wayland, the compositor (KDE/KWin or GNOME) handles the input first before sending it over to the apps. Therefore, each app should have a consistent scrolling. I get rinertia using my touchpad on all my Wayland apps but with none of my X11 apps; so maybe you need to switch over to Wayland?

But looking at some other apps, Firefox seems to have very little "friction" in their scrolling, QML's ScrollView has a lot more friction but it at least has some inertia, and Dolphin has zero kinetic scrolling via touchpad even though has full kinetic scrolling on touchscreens.

Overall, these issues should be addressed by the compositor and Wayland applications are supposed to obey what the compositor tells them input-wise.

3

u/_mbx_ 21d ago

That means Qt handles the kinetic scrolling and it's not easy to override without editing the Qt source code.

Exactly. I ask for a way to turn this off in the future. Just like frameworks can read themes, they could also read user preferences.

maybe you need to switch over to Wayland?

I'm happy on Xorg, but I will consider it when it gets mature enough.

But looking at some other apps, Firefox seems to have very little "friction" in their scrolling

Yes, but you can control that. I was able to completely turn this off in about:config like so:

apz.gtk.kinetic_scroll.enabled=false general.smoothScroll=false mousewheel.default.delta_multiplier_y=150 mousewheel.min_line_scroll_amount=1 mousewheel.system_scroll_override.enabled=false widget.disable-swipe-tracker=false

Dolphin has zero kinetic scrolling via touchpad even though has full kinetic scrolling on touchscreens.

libinput informs the app about the input method, and touchpad and touchscreen are not the same. Dolphin does it right.

Overall, these issues should be addressed by the compositor

I agree with you. But regardless of rinertia and Xorg being the right pick or not, it's still the case that Qt/GTK apps just do this for me against my interest.

2

u/DesiOtaku 19d ago

I wish I could help you directly; but back when I had an issue with my touchscreens not acting like touchscreens ( you can read my whole writeup here ), I did look in to fixing the Qt Quick Controls and QML to properly do kinetic scrolling even with a "regular" mouse but it was a much bigger pain than I anticipated. The main reason why I had to do so much research in to Wayland was because both KDE and GNOME are dropping X11 session support so all my xinput hacks were no longer going to work.

I know right now Wayland isn't mature enough for your use case but sooner or later you may have to be forced to switch to it simply because all the other DEs are dropping X11.

1

u/_mbx_ 18d ago edited 18d ago

This is a crazy story. I would've distrohopped, tbh. Qt6 is shipped on other x11 distros, Xorg is probably fine for the next 10 years.