Bug 420492 - 20.04.0 significantly slows down mouse scrolling with a "hyperscroll" mouse or a touchpad driver that sends mouse wheel scroll events when configured for greater speed
Summary: 20.04.0 significantly slows down mouse scrolling with a "hyperscroll" mouse o...
Status: RESOLVED FIXED
Alias: None
Product: okular
Classification: Applications
Component: general (show other bugs)
Version: 20.04.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2020-04-24 01:58 UTC by roger truong
Modified: 2020-04-30 04:36 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 1.10.1


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description roger truong 2020-04-24 01:58:03 UTC
SUMMARY
20.04.0 update breaks fast scrolling in Okular. Most noticeable with a "hyperscroll" mouse wheel.

STEPS TO REPRODUCE
1. open any PDF or EPub file in 20.04.0
2a. with a hyperscroll mouse, free scroll the mouse wheel inside the document panel
2b. with a normal mouse, scroll as fast as possible inside the document window
3. downgrade to 1.9.3 and repeat step 2

OBSERVED RESULT
Scrolling the same amount of clicks scrolls down less lines in 20.04.0 compared to 1.9.3. Scrolling with a hyperscroll wheel significantly limits the speed of scrolling to make free scrolling unusable. This bug is only observed when scrolling in the document panel. Scrolling in the navigation panel or in the scrollbar on the right produces the expected scroll speed.

EXPECTED RESULT
The scroll speed in the document panel is as fast as in the other panels and keeps the same speed as 1.9.3

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 5.18.4.1-1
KDE Frameworks Version: 5.69.0
Qt Version: 5.14.2 (built against 5.14.2)

ADDITIONAL INFORMATION
Mouse: Logitech G502 with free scroll
also tested with a generic mouse with normal scroll wheel

videos of the scrolling attached:
https://youtu.be/wIts9r-meME
https://youtu.be/nfDjuFkjQLE
Comment 1 David Hurka 2020-04-24 12:08:59 UTC
Might be related to smooth scrolling. (I don’t like smooth scrolling at all, so that is my first suspection.)

I can confirm that pixel wise scrolling speed is limited too. If I configure my touchpad to scroll faster, scroll speed is limited to a speed similar to that in your video. But when I stop scrolling, it appears to jump directly to the position where it would have scrolled to without speed limitation.
Comment 2 Keziolio 2020-04-24 18:59:57 UTC
In the original discussion about the smooth scrolling we diverged from the Qt defaults in some settings, you are probably affected by this configuration

https://invent.kde.org/kde/okular/-/blob/master/ui/pageview.cpp#L450

Unfortunately I don't have a mouse with that feature, are you able to test with that value increased from 1 to something like 5-10, at your liking?

I can provide you with a precompiled archlinux package if you trust random binaries from the internet
Comment 3 David Hurka 2020-04-24 20:49:51 UTC
1. I don’t think that the touchpad driver sends mouse wheel scroll events like a mouse wheel does. The mouse wheel is discrete, while the touchpad has pixel-wise scrolling (which I really like very much).

2. Yes, I will be able to test that. I can compile Okular, and I also have a hyperscroll mouse “somewhere”. Otherwise there is nothing about converting my recently bought (so silly, why didn’t I just take the hyperscroll mouse?) USB mouse to a hyperscroll mouse. Other-otherwise, you can simply simulate discrete scroll events with e. g. `while [[ true ]] do sleep 0.002; xdotool click 5; done`

3. By the way, I don’t like smooth scrolling, is it possible to disable QScroller globally? That would be so nice!
Comment 4 David Hurka 2020-04-24 20:51:48 UTC
Oh, and thanks for pointing that out so quickly, Kezik!
Comment 5 Keziolio 2020-04-24 21:08:02 UTC
1) I don't clearly remember the details, but I remember the fact that I had to do a fair bunch of hacks because Qt on Linux doesn't give us precise informations on the matter, this is the reason we don't have the inertial scrolling on touchpad; if I remember correctly, unfortunately, everything goes down the same pipe: mouse discrete scrolling, mouse free scroll, touchpad scroll, etc.

And yes, I opened a Qt issue, and they told me to bugger off, you can see the details on the original discussion

And yes, this is quite sad and is currently the bottleneck in getting all of this working in a decent way, but I'm not sure if I have the energy to try and patch upstream Qt 

2) By "you" I was meaning to the bug OP, not you David :P I'm sure you can compile Okular 

3) It'be cool to have all the options in the Okular settings panel, I'm not aware on a method to disable it
Comment 6 roger truong 2020-04-24 22:19:59 UTC
I complied from source and tested out different MaximumVelocity values, trying 1, 10, and 100. Increasing the values made scrolling appear to accelerate faster, but it was still capped at the same maximum scroll speed.
Comment 7 David Hurka 2020-04-25 12:14:36 UTC
(In reply to Keziolio from comment #5)
> this is the reason we don't have the inertial
> scrolling on touchpad;

What do you mean? My Okular from git master always supported inertial scrolling with the touchpad. You just need to enable it in System Settings.
Comment 8 Nate Graham 2020-04-25 14:50:43 UTC
(In reply to David Hurka from comment #7)
> (In reply to Keziolio from comment #5)
> > this is the reason we don't have the inertial
> > scrolling on touchpad;
> 
> What do you mean? My Okular from git master always supported inertial
> scrolling with the touchpad. You just need to enable it in System Settings.
You must be using the Synaptics driver. With this older driver, inertial scrolling can be provided by the driver itself sending scroll events with some falloff. When using the successor Libinput driver (which seems to be installed by default in most distros these days), inertial scrolling is not a driver feature and must be handled by the toolkit or application.
Comment 9 Albert Astals Cid 2020-04-26 14:28:10 UTC
(In reply to Keziolio from comment #5)
> And yes, this is quite sad and is currently the bottleneck in getting all of
> this working in a decent way, but I'm not sure if I have the energy to try
> and patch upstream Qt 

Honestly that's not a good enough answer, if you break something, you fix it, those are the rules. Whether you have to fix things in Okular, Qt or X11 shouln't matter.
Comment 10 Keziolio 2020-04-26 14:58:23 UTC
Albert,
Regarding the touchpad, nothing was broken, the behavior is the same as before


Regarding the hyperscroll mouse, I have no idea since I don't have that device, it's still not "broken"

My digression was an answer to David's comment, regarding the fact that the hyperscoll device events are probably handled in the same way as a regular mouse / touchpad, and that's quite suboptimal if we want to achieve a polished experience, but it's not worse than it was before

There is no major breakage, calm down


Regarding the original bug, the behaviour of the scroll events is programmed to be literally the same as it was before, probably QScroller::scrollTo behaves in a suboptimal way if it's flooded with events, I'll see if something comes to mind
Comment 11 Albert Astals Cid 2020-04-26 15:08:09 UTC
(In reply to Keziolio from comment #10)
> Albert,
> Regarding the touchpad, nothing was broken, the behavior is the same as
> before
> 
> 
> Regarding the hyperscroll mouse, I have no idea since I don't have that
> device, it's still not "broken"

Well, if i read the bug it says it previously worked and now it doesn't, to me that says something broke.
Comment 12 David Hurka 2020-04-26 21:48:47 UTC
@Albert, Kezik:
I think that both your views don’t are ultimately right. It’s not that something clearly broke, neither is it that nothing broke.

When Kezik implemented the smooth scroll feature, the funktional feature set of Okular didn’t change. It just looks a bit better now. Let us say, scrolling has  more “wow” now.

Now it turns out that Okular performs worse at fast scrolling. Again, the functional feature set of Okular didn’t change. It is just a bit slower now. Let us say, fast scrolling has less “wow” now.

So I think that no one strictly needs to fix this now. I also don’t think that we shouldn’t do anything now. I think we should evaluate the improvements and regressions, and how we could fix the regressions, and whether it is worth the work.

I suggest to look at QScroller, to investigate why it doesn’t scroll fast enough. But I fear that its arithmetics implicate some limit, so it would be much work to fix it.
Comment 13 roger truong 2020-04-26 22:57:02 UTC
After looking through the rest of pageview.cpp, I think I narrowed down the problem to the auto limit_value function. 

https://invent.kde.org/kde/okular/-/blob/master/ui/pageview.cpp#L5369
https://invent.kde.org/kde/okular/-/blob/master/ui/pageview.cpp#L5400


(In reply to Keziolio from comment #10)
> Regarding the original bug, the behaviour of the scroll events is programmed
> to be literally the same as it was before, probably QScroller::scrollTo
> behaves in a suboptimal way if it's flooded with events, I'll see if
> something comes to mind

Changing the value for nSteps to 2000 from 200 brought back the scrolling from previous versions. It seems that the regression may be in animation speed rather than scrolling if none of the code has changed.

It also brought up another bug in the animations with the Contents view. When continuously scrolling, the headings don't advance as they did in 1.9.x. It jumps to whatever heading the current page is on once scrolling has stopped. I'm unsure if this qualifies for a separate bug report, as the synchronous nature of the animations lead me to believe these bugs may be related. The effect can be seen in Contents pane of the videos attached in the OP as well.
Comment 14 Till Schäfer 2020-04-29 20:00:40 UTC
I just stumbled over this. This is really painful. I am only able to scroll 1-2 pages per second. It is happening with my notebook and the synaptics driver as well with my desktop and a free spin scroll wheel. I am using the scroll bar again.. :-/ 

I do not think, that scroll speed should be limited at all. I would like to have a 1:1 relation between my wheel speed and the scroll speed to get an intuitive experience. previously i just new how long my wheel needs to be spun until i reach \approx 20 pages.

If there is no time to fix this, please revert back to the old model. I like inertial scrolling, but its not worth this bug. This one really limits productivity.
Comment 15 Keziolio 2020-04-29 20:05:24 UTC
> Changing the value for nSteps to 2000 from 200 brought back the scrolling
> from previous versions. It seems that the regression may be in animation
> speed rather than scrolling if none of the code has changed.

So it turns out that the hyperscroll mouse doesn't do per pixel scrolling, it just sends normal mouse events at an ungodly rate
Comment 16 Till Schäfer 2020-04-29 20:10:59 UTC
(In reply to roger truong from comment #13)
> After looking through the rest of pageview.cpp, I think I narrowed down the
> problem to the auto limit_value function. 
> 
> https://invent.kde.org/kde/okular/-/blob/master/ui/pageview.cpp#L5369
> https://invent.kde.org/kde/okular/-/blob/master/ui/pageview.cpp#L5400
> 

 //if we are too far behind the animation, do nothing and let it catch up
    auto limit_value = nSteps ? 200 : verticalScrollBar()->rect().height();

Does this mean, scrolling waits for the animation? If that is the case: 
I think, that the scroll behavior should never ever wait for the animation. This is horrible on slow computers (and also on fast ones while they are doing some heavy workload). Please, just skip the animation in this case. Does this imply, that the max scroll speed depends on the system load?
Comment 17 Keziolio 2020-04-29 20:19:26 UTC
The animation is controlled by time and it's independent from system performance
Comment 18 Till Schäfer 2020-04-29 20:23:30 UTC
(In reply to Keziolio from comment #17)
> The animation is controlled by time and it's independent from system
> performance

oh, that makes me feel better. thx for the fast reply. and sry for my rushed/harsh comment here (shouldn't read some political articles and comment at the same time :P).
Comment 19 Nate Graham 2020-04-29 22:16:28 UTC
Git commit 08d368c13b0fa7368be9720b8de1b7a67188b8e9 by Nate Graham, on behalf of Kezi Olio.
Committed on 29/04/2020 at 22:15.
Pushed by ngraham into branch 'release/20.04'.

Fix scroll speed with free-spinning mouse wheels
FIXED-IN: 1.10.1

This just removes the smooth mouse wheel scrolling, fixing that problem.

M  +4    -10   ui/pageview.cpp

https://invent.kde.org/kde/okular/commit/08d368c13b0fa7368be9720b8de1b7a67188b8e9
Comment 20 roger truong 2020-04-30 04:36:50 UTC
(In reply to Nate Graham from comment #19)
> Git commit 08d368c13b0fa7368be9720b8de1b7a67188b8e9 by Nate Graham, on
> behalf of Kezi Olio.

I just tested the commit and that fixed my issues, thank you!