Bug 443819 - Ctrl+Scroll to zoom is incompatible with inertia touchpads
Summary: Ctrl+Scroll to zoom is incompatible with inertia touchpads
Status: REPORTED
Alias: None
Product: okular
Classification: Applications
Component: general (show other bugs)
Version: 21.08.1
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
: 353330 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-10-16 07:20 UTC by Roberto
Modified: 2023-03-25 08:17 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Roberto 2021-10-16 07:20:01 UTC
SUMMARY

pressing CTRL during inertia scrolling zooms the page, although this is not wanted


STEPS TO REPRODUCE
1. scroll down with touchpad two-fingers so that inertia scrolling is triggered
2. hold CTRL button

OBSERVED RESULT

zoom quickly goes to maximum or minimum value (depending on the scroll direction)



EXPECTED RESULT

nothing should happen

SOFTWARE/OS VERSIONS
linux: ubuntu devel
KDE Frameworks 5.86.0
Qt 5.15.2 (compilato con 5.15.2)
Comment 1 Albert Astals Cid 2021-10-18 22:20:46 UTC
This is exactly what it is supposed to do, i don't understand why it should not do that?

Don't press Ctrl if you don't want to change the zoom?
Comment 2 Roberto 2021-10-19 05:58:32 UTC
Maybe I did not explain myself clearly. The problem occurs when one scrolls fast with the touchpad and then raises the hand so that due to inertia the page keeps scrolling. During such inertia scrolling (withouth any touchpad contact), if one presses ctrl (for example ctrl+f to find some text, or other shortcuts with ctrl) the page becomes huge or minute, depending on the scroll direction.

*inertia* triggering zoom is definitely not "what it is supposed to do", because one cannot control the zoom level in that way.

I see two ways to solve this bug:

1) ctrl+scroll shortcut to zoom acting only until fingers are in contact with the touchpad

2) provide an option to disable ctrl+scroll to zoom the page

I think the second way is clean and simple, and I would vote for it.
Comment 3 Laura David Hurka 2021-10-19 13:02:33 UTC
> Ctrl+Scroll to zoom is incompatible with inertia touchpads

As I understood it, this is the main reason why inertia is nowadays no longer done in the touchpad driver. So:

3) Disable inertia in your touchpad driver.

Qt (the GUI framework used by Okular) provides a concept to communicate when the finger is lifted from the touchpad while scrolling. But to my knowledge, touchpad drivers do not communicate this. Implementing suggestion 1 in Okular would probably be unreliable.

Suggestion 2 seems most realistic, but I think we are concerned about bloating the configuration dialog.
Comment 4 Roberto 2021-10-19 13:28:26 UTC
Inertia is a feature that I use a lot in okulaŗ, and I'm happy with it.

The fact that it conflicts with a shortcut is a bug that one should be able to prevent.

It's not clear to me how is it possible that okular doesn't know when the finger is lifted: how otherwise would okular control inertia and scrolling?

Beside solving the above issue, which I believe is the main bug source, IMO the situation requires that one should be able at least to remove or change the shortcut, whether in the gui or not: if you don't like to bloat the config dialog please add an alternative way to disable/change it. For example by manual modification of a config file?
Comment 5 Laura David Hurka 2021-10-19 21:16:12 UTC
I understood your bug report in the way that your touchpad driver implements inertia.

Okular does not have inertia for scroll input, because of the problem I have outlined. It only has inertia for swipe (flick) gesture input. If you observe inertia after scrolling with the touchpad, that is because your touchpad driver implements it.

Okular just does what your hardware tells it to do.

---

In case you can compile Okular from source, you can search for Qt::ControlModifier in PageView::wheelEvent(). It’s located in part/pageview.cpp around line 3200, and the source code is available at https://invent.kde.org/graphics/okular.

If you remove the if branch with this Qt::ControlModifier, your Okular will not zoom with Ctrl+scroll. :)
Comment 6 Roberto 2021-10-20 06:15:38 UTC
(In reply to David Hurka from comment #5)
> Okular does not have inertia for scroll input, because of the problem I have
> outlined. It only has inertia for swipe (flick) gesture input. If you
> observe inertia after scrolling with the touchpad, that is because your
> touchpad driver implements it.
> 
> Okular just does what your hardware tells it to do.

I see. Then I agree that solution (1) is not possible.


> In case you can compile Okular from source, you can search for
> Qt::ControlModifier in PageView::wheelEvent(). It’s located in
> part/pageview.cpp around line 3200, and the source code is available at
> https://invent.kde.org/graphics/okular.
> 
> If you remove the if branch with this Qt::ControlModifier, your Okular will
> not zoom with Ctrl+scroll. :)

yes, thanks, but that implies that I would need to recompile at each update. Not a long term solution. Why not putting a flag in okularpartrc? Many other users have this problem, and it's a general kde bug which is around since almost 10 years

https://bugs.freedesktop.org/show_bug.cgi?id=76094

and still not fixed. Some dev please put an option to disable it.
Comment 7 Roberto 2021-10-20 06:46:26 UTC
By the way, I've found out that the very same bug was fixed in kate and then in konsole: https://bugs.kde.org/show_bug.cgi?id=403285 

Therefore it must be actually fixable also in Okular.
Comment 8 Laura David Hurka 2021-10-20 13:58:52 UTC
*** Bug 353330 has been marked as a duplicate of this bug. ***
Comment 9 Laura David Hurka 2021-10-20 14:02:44 UTC
Okay, thanks for the link. These workarounds can probably be adapted to Okular.

https://commits.kde.org/ktexteditor/f51befdc80b1a8dfd65b800b3b10dba97d10a2cb

https://commits.kde.org/konsole/1af0a1d53399a4a0b3ccdd043cc9a7db30e659e0
Comment 10 elvisvan 2023-03-24 08:23:47 UTC
and here i am been desperately trying for weeks to implement this exact same thing on my fedora kde plasma wayland system, inertia scrolling and touchpad gestures (4-finger tap to play/pause & swipe to adjust volume) are the 2 biggest linux hiccups for me to comfortably forget windows, and looks like i'm here too early for wayland to have them natively supported :(
Comment 11 elvisvan 2023-03-24 08:30:52 UTC
(In reply to Albert Astals Cid from comment #1)
> This is exactly what it is supposed to do, i don't understand why it should
> not do that?
> 
> Don't press Ctrl if you don't want to change the zoom?

more accurately is "if you're gonna switch application, stop the scrol, it's a feature you're using it wrong"
Comment 12 Roberto 2023-03-25 08:17:00 UTC
(In reply to elvisvan from comment #11)
> more accurately is "if you're gonna switch application, stop the scrol, it's
> a feature you're using it wrong"

your reply as if you have read only comment 1 and not the full thread

it's not a feature, but rather an (unwanted) interference between features