Fix smooth scrolling in compact view using mouse wheel.#108
Conversation
|
|
I have a few more questions because I only have smooth scrolling with the touchpad, not with the mouse. Do you have smooth scrolling with the mouse in the other views? If so, is smooth scrolling in compact view with your patch just as fast as in the other views? With my touchpad, I need a factor of about 33.3 to achieve roughly the same speed as in the other views where smooth scrolling is handled by GtkScrolledWindow itself. I'm wondering if the mouse's +/- 1 is simply informative or if it's actually a (configurable?) value. |
Yes, even for left-right drag, the value is for delta_y.
If just as fast means how much distance in pixels per wheel roll/drag, then:
Oh, so at your side there's distance difference between views? Just in case, if we put this at line 2821 (after new adjustment value): printf("scroll delta[x:%.3f,y:%.3f,=:%.3f] value:%.3f\n", delta_x, delta_y, delta, value);mine have this (dragging down from far-left, then drag right, delta[0,0,0] is when starting movement):
I've used imwheel to increase wheel scroll size on host, no effect to delta value in list view, but the speed (distance) itself increased for all views. I don't know how to externally set that delta (simply got from |
|
Thanks for the detailed and helpful reply. Taking all the information into account, and because your original patch does not allow horizontal left scrolling (delta_x < 0), I have modified it slightly. Once you have tested it and are happy with it, I will apply it. |
3e4e3e1 to
ad26e9b
Compare
What the heck, even though I keep talking about delta_y can be +/- 1/2, I totally missed to consider negative delta_x. OK, tested on my side to be working fine for both wheel rolling and dragging. Though 2 questions:
|
|
Instead of #37, it's lxde/pcmanfm#37. Fixed with commit below. |
I previously increased delta_x, but now I'm decreasing delta (touchpad deltas are < 1), which also seems more plausible. The new scrolling speed is okay for me, and I got rid of the hard-coded factor.
I didn't notice any of that during my tests — but indeed, you can force diagonal movement. So, let's give delta_y the preference. Fixed with commit below.
Thanks for noticing! |
Just in case there's misunderstanding, I'm not talking/claiming user mostly use up-down movement compared to left-right. It's in case when user uses up-down movement and the movement is not clean, previous commit would keep using delta_x that probably has small value, which results in small scrolling speed even though delta_y is large (user makes movement in that axis/direction after all). Latest commit has I can make it to use largest delta so that no priority is given to any axis. As long it detects scrolling/dragging, it'll move. Is that acceptable? //cannot use MAX(ABS(x), ABS(y)) since result sign/direction will be missing
value = (ABS(delta_x) >= ABS(delta_y)) ? delta_x : delta_y;
delta *= CLAMP(value, -1, 1); |
Although GtkScrolledWindow has a horizontal scroll bar in compact view, the icons are arranged vertically. Therefore, delta_y must be considered in addition to delta_x. Depending on the scroll direction, one of the two values is always 0. Assuming that the smooth delta values are fractions of the determined delta value, get rid of the fixed factor. Clamp the smooth delta values because scrolling with a held button reportedly returns +/- 2. This closes github issue lxde/pcmanfm#37, reported by tro-oper. (commit and commit message amended by committer)
No, I think I understand. During my tests, I never experienced diagonal scroll deltas. You have to scroll at an extremely steep angle to achieve this, and as you said, the movement is in the y-axis/y-direction after all. So, it seems reasonable to prefer delta_y.
It seems that the touchpad smooths the movement unless you move at an extremely steep angle. Below a cosmetic change. |
Oh, I see, didn't know that. OK then, at this point LGTM. |
|
Thank you very much for your contribution. |
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):
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).