libfm icon indicating copy to clipboard operation
libfm copied to clipboard

Fix smooth scrolling in compact view using mouse wheel.

Open yagi-tan opened this issue 4 months ago • 0 comments

In Debian Trixie with X11, PCManFM 1.4.0 is not able to scroll in compact view using mouse wheel. Apparently, with both GDK_SCROLL_MASK and GDK_SMOOTH_SCROLL_MASK set, only smooth scroll events are generated, and gdk_event_get_scroll_deltas() only sets Y delta value while X delta is set to 0 for such event. I've changed that to consider Y delta when X delta is small enough so that it won't change previous behaviour while fixing the problem.

For testing, I only tested this on mouse as I don't have touchpad so I don't know what's valid deltas' value range coming from the latter. There're 2 variations for the mouse wheel (X delta is always 0):

  1. Normal usage of rolling the wheel. The delta value is either -1 or 1.
  2. With "libinput Scroll Method Enabled" is set to "0, 0, 1" so that user can scroll by dragging mouse while holding wheel (middle) button down. For left-right drag, delta value is either -2 or 2. For up-down drag, it's either -1 or 1.

I don't know the best scroll delta value (previously it's fixed to 33.3, changed to match what GDK_SCROLL_MASK use since it's too small for my usage), with those variations might make scrolling 'jumpy' too much. I'm tempted to clamp the delta value to [-1,1], though wanting to confirm touchpad delta value first (seems to be fractional like 0.4).

yagi-tan avatar Oct 14 '25 04:10 yagi-tan