Disabling kinetic scrolling with touchpad

Hello.

I’d like to disable kinetic scrolling in my scrolled window. I noticed that the documentation for ScrolledWindow:kinetic-scrollingmentions the following:

Kinetic scrolling only applies to devices with source GDK_SOURCE_TOUCHSCREEN.

This is quite unfortunate as kinetic scrolling almost ruins the application, because it’s very annoying to deal with both for the user and for the developer.
Is there any way to disable kinetic scrolling for touchpads? I haven’t tried it with a mouse yet because I don’t have one with me right now, but I suppose that kinetic scrolling isn’t a thing with mice.

Hi,

It’s possible with a bit of hacks:

Loop over the GtkScrolledWindow’s controllers you get from Gtk.Widget.observe_controllers , if you see a GtkEventControllerScroll then clear the GTK_EVENT_CONTROLLER_SCROLL_KINETIC bit from its Gtk.EventControllerScroll:flags .

1 Like

Thanks for the reply.
Despite this being a hack, this unfortunately seems to be the best solution if you want to solely disable kinetic scrolling all while keeping the rest of the default scroll behaviour.
I realised that in the context of my application, I’d rather take full control of scrolling in the scrolled window, so I simply now return GDK_EVENT_STOP from my GtkEventControllerScroll::scroll event handler if I’ve handled the scrolling myself, which has the side effect of not performing any kinetic scrolling.

1 Like