Bug 479028

Summary: Horizontal scrolling on the applet sliders is backwards when invert scroll direction is disabled
Product: [Plasma] plasma-pa Reporter: verstecktezauberei <verstecktezauberei>
Component: appletAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: minor CC: fanzhuyifan, isma.af, me, nate, notmart, nowrep, vlad.zahorodnii
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=459624
Latest Commit: Version Fixed In: 6.0
Sentry Crash Report:

Description verstecktezauberei@gmail.com 2023-12-26 13:00:59 UTC
SUMMARY
Horizontal scrolling on the widget's icon in the system tray is the wrong way around as would be intuitive; scrolling right decreases volume, and scrolling left increases volume.


STEPS TO REPRODUCE
1. Scroll right/left on a touchpad (as opposed to up/down)
2. 
3. 

OBSERVED RESULT
the volume slider will change in the wrong direction

EXPECTED RESULT
for the volume slider to change in the right direction

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 fanzhuyifan 2024-01-24 04:51:40 UTC
This only seems to happen when invert scroll direction (natural scrolling) is not enabled. Also happens with mouse.
Comment 2 fanzhuyifan 2024-01-24 04:56:06 UTC
This behavior seems to be implemented in org.kde.plasma.components.Slider
Comment 3 Nate Graham 2024-01-24 16:11:34 UTC
This should already be fixed in Plasma 6 with Qt 6.7.
Comment 4 Nate Graham 2024-01-24 16:11:52 UTC

*** This bug has been marked as a duplicate of bug 442379 ***
Comment 5 fanzhuyifan 2024-01-24 16:13:02 UTC
(In reply to Nate Graham from comment #3)
> This should already be fixed in Plasma 6 with Qt 6.7.

I was testing on plasma 6 with Qt6.7..
Comment 6 Nate Graham 2024-01-24 16:14:45 UTC
That's odd. CCing Vlad who knows the current status here.
Comment 7 Vlad Zahorodnii 2024-01-24 22:08:09 UTC
> This behavior seems to be implemented in org.kde.plasma.components.Slider

system tray representation has custom wheel handling code. can you run plasmashell with WAYLAND_DEBUG=1 and post output here. Please avoid scrolling anywhere but the system tray icon so it's easier to find the relevant part in the logs
Comment 8 fanzhuyifan 2024-01-24 22:24:15 UTC
(In reply to Vlad Zahorodnii from comment #7)
> > This behavior seems to be implemented in org.kde.plasma.components.Slider
> 
> system tray representation has custom wheel handling code. can you run
> plasmashell with WAYLAND_DEBUG=1 and post output here. Please avoid
> scrolling anywhere but the system tray icon so it's easier to find the
> relevant part in the logs

Oh sorry. I could only reproduce this when scrolling on the sliders in the applet, which seems to use org.kde.plasma.components.Slider.

For me scrolling on the widget itself works fine, with or without natural scrolling.
Comment 9 Bug Janitor Service 2024-02-06 16:34:37 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/libplasma/-/merge_requests/1051
Comment 10 Fushan Wen 2024-02-13 03:25:36 UTC
Git commit 50fe4f1f9ba1805c69c558d8c3c05af433087623 by Fushan Wen, on behalf of Yifan Zhu.
Committed on 13/02/2024 at 01:17.
Pushed by fanzhuyifan into branch 'master'.

applet: fix unable to finetune slider

The internal value of a slider always changes by multiples of stepSize,
regardless of the value of snapMode, so setting snapMode does not work.
Instead, implement custom wheel event handling.

Also fixes horizontal scrolling behavior when invert scroll direction is
disabled.

This commit borrows from Slider.qml and
5d6d74ef68889da7400cb2a16a73527f1927424d in qqc2-desktop-style.

M  +4    -1    applet/contents/ui/ListItemBase.qml
M  +33   -0    applet/contents/ui/VolumeSlider.qml

https://invent.kde.org/plasma/plasma-pa/-/commit/50fe4f1f9ba1805c69c558d8c3c05af433087623
Comment 11 fanzhuyifan 2024-02-13 03:27:24 UTC
Git commit 63462b6b1d3487d5053f30daae0d32cd1c006527 by Yifan Zhu.
Committed on 13/02/2024 at 03:26.
Pushed by fanzhuyifan into branch 'Plasma/6.0'.

applet: fix unable to finetune slider

The internal value of a slider always changes by multiples of stepSize,
regardless of the value of snapMode, so setting snapMode does not work.
Instead, implement custom wheel event handling.

Also fixes horizontal scrolling behavior when invert scroll direction is
disabled.

This commit borrows from Slider.qml and
5d6d74ef68889da7400cb2a16a73527f1927424d in qqc2-desktop-style.


(cherry picked from commit 50fe4f1f9ba1805c69c558d8c3c05af433087623)

M  +4    -1    applet/contents/ui/ListItemBase.qml
M  +33   -0    applet/contents/ui/VolumeSlider.qml

https://invent.kde.org/plasma/plasma-pa/-/commit/63462b6b1d3487d5053f30daae0d32cd1c006527
Comment 12 fanzhuyifan 2024-02-13 20:03:13 UTC
Git commit aea3d4b131070d8388edf84c9c2a32f7b4203617 by Yifan Zhu.
Committed on 13/02/2024 at 20:01.
Pushed by fanzhuyifan into branch 'master'.

Slider: Fix slider scrolling direction

We always want the slider to increase its value when scrolling
up or right, no matter the inverted scrolling setting.

For "regular" scrolling, this corresponds to positive values on
the Y axis and negative values on the X axis. For "natural"
scrolling (indicated by the `inverted` property) is the opposite
so we need to reverse the sign.

Note that the Qt documentation on WheelEvent is dubious:
On https://doc.qt.io/qt-5/qml-qtquick-wheelevent.html, the
`angleDelta` section suggests that positive should be up/right,
but the `inverted` section indicates the above mentioned behavior.

This commit borrows from Slider.qml and
5d6d74ef68889da7400cb2a16a73527f1927424d in qqc2-desktop-style.
Related: bug 479879
FIXED-IN: 6.0

M  +38   -1    src/declarativeimports/plasmacomponents3/Slider.qml

https://invent.kde.org/plasma/libplasma/-/commit/aea3d4b131070d8388edf84c9c2a32f7b4203617
Comment 13 fanzhuyifan 2024-02-13 20:06:23 UTC
Git commit 249c56925682c478ef2b4be18cfc0b0fcefa2e92 by Yifan Zhu.
Committed on 13/02/2024 at 20:04.
Pushed by fanzhuyifan into branch 'Plasma/6.0'.

Slider: Fix slider scrolling direction

We always want the slider to increase its value when scrolling
up or right, no matter the inverted scrolling setting.

For "regular" scrolling, this corresponds to positive values on
the Y axis and negative values on the X axis. For "natural"
scrolling (indicated by the `inverted` property) is the opposite
so we need to reverse the sign.

Note that the Qt documentation on WheelEvent is dubious:
On https://doc.qt.io/qt-5/qml-qtquick-wheelevent.html, the
`angleDelta` section suggests that positive should be up/right,
but the `inverted` section indicates the above mentioned behavior.

This commit borrows from Slider.qml and
5d6d74ef68889da7400cb2a16a73527f1927424d in qqc2-desktop-style.
Related: bug 479879
FIXED-IN: 6.0


(cherry picked from commit aea3d4b131070d8388edf84c9c2a32f7b4203617)

M  +38   -1    src/declarativeimports/plasmacomponents3/Slider.qml

https://invent.kde.org/plasma/libplasma/-/commit/249c56925682c478ef2b4be18cfc0b0fcefa2e92