Search code examples
gtkswt

How to disable touchscreen events in GTK3 ScrolledWindow


I developing kiosque app using SWT running on Linux. Recently I've switched underling backend from GTK 2.0 to GTK 3.0

I've noticed that ScrolledComposite have "build-in" scroll behavior. Is there a way to disable it? I've dug through GTK 3.0 dock and found something like this:

 * `GtkScrolledWindow` has built-in support for touch devices. When a
 * touchscreen is used, swiping will move the scrolled window, and will
 * expose 'kinetic' behavior. This can be turned off with the
 * [[email protected]:kinetic-scrolling] property if it is undesired.

But I have no idea how to set it. Maybe anyone show me how to set this property in settings.ini, theme file or point me to tutorial/docs where this is explained

EDIT I've installed GtkInspector then run my app and found widget GtkScrolledWindow. Switching property "kinetic-scrolling" to false do the trick. But how i can save this setting?


Solution

  • swt doesn't expose such gtk properties to users. Easiest way to disable kinetic scrolling is modify and recompile gtk sources. I've got answer on discourse.gnome.org from user Ebassi: If you want to know where to modify GTK,

     1. open gtkscrolledwindow.c
     2. find gtk_scrolled_window_class_init
     3. find the g_param_spec_boolean("kinetic-scrolling",...) call and modify the default value from TRUE to FALSE
     4. find gtk_scrolled_window_init
     5. find the gtk_scrolled_window_set_kinetic_scrolling(..., TRUE) and modify the argument from TRUE to FALSE
     6. Then rebuild GTK and replace the installed version on your system.