Bug 502583

Summary: [Wayland] Scroll input is doubled in the same direction
Product: [Plasma] kwin Reporter: madness742
Component: inputAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED UPSTREAM    
Severity: normal CC: duha.bugs, xaver.hugl
Priority: NOR    
Version First Reported In: 6.3.4   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Showcase of the bug.
virt-viewer with WAYLAND_DEBUG=1

Description madness742 2025-04-08 22:29:00 UTC
Created attachment 180104 [details]
Showcase of the bug.

SUMMARY
I initially reported this on virt-viewer GitLab, but I'm unable to reproduce it on Gnome. (https://gitlab.com/virt-viewer/virt-viewer/-/issues/161)

When scrolling in the virt-viewer, every second scroll input in the same direction is doubled.

STEPS TO REPRODUCE
1. Create a Linux VM in virt-manager.
2. Open a web browser.
3. Scroll in the same direction.

OBSERVED RESULT
Every other scroll in the same direction, is doubled.

EXPECTED RESULT
It should only send one scroll input.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Fedora 41
KDE Plasma Version: 6.3.4
KDE Frameworks Version: 6.12.0 
Qt Version: 6.8.2

ADDITIONAL INFORMATION
This bug also affects connections to the VM using different clients, such as Remmina. Oddly enough, Moonlight doesn't appear to be affected.

Workaround for this bug:
- Launch virt-manager/virt-viewer with GDK_BACKEND=x11.
- Use 'Redirect USB Device' for the mouse in virt-viewer, but this makes the cursor invisible.
Comment 1 Zamundaaa 2025-04-09 13:23:11 UTC
Do you have a non-default scroll speed configured in system settings?
Comment 2 madness742 2025-04-09 16:39:22 UTC
(In reply to Zamundaaa from comment #1)
> Do you have a non-default scroll speed configured in system settings?

I'm using the default scroll speed settings, this bug also happens on a clean install of Fedora 41.

I've also tried several input devices in case it was the hardware to blame:
- Ploopy Adept (QMK, wired)
- Kesington Slimblade Pro (USB, wired and dongle)
- Pulsar Xlite V2 (Dongle)
- Logitech MX Master 3s (Bluetooth and dongle)
Comment 3 madness742 2025-04-12 00:37:29 UTC
I've changed the status back to "REPORTED", please let me know if you need more information.
Comment 4 Zamundaaa 2025-05-26 14:33:37 UTC
Another thing we can check: Please run virt-viewer with WAYLAND_DEBUG=1, do a few scroll steps, and attach the output of that here
Comment 5 madness742 2025-05-26 17:17:53 UTC
Created attachment 181764 [details]
virt-viewer with WAYLAND_DEBUG=1

I have started virt-manager with the `WAYLAND_DEBUG=1` variable, and scrolled a couple of times down and up.
Comment 6 madness742 2025-05-27 13:48:01 UTC
The scroll wheel behaviour was acting different than usual when I was capturing the logs.

I used Google Chrome, instead of Firefox and it seems that using ozone-platform X11 (default) not only has the double scroll input bug, but also makes it skip scrolling. 

Launching Chrome with `--ozone-platform=wayland` fixes the skipped scrolls, but it still leaves me with the double scroll input bug.

To reproduce the first skipped scrolling bug (affecting only the VM):
1. Start Google Chrome/Chromium with `--ozone-platform=X11`.
2. Go to a web page (https://fedoramagazine.org).
3. Start scrolling down, line by line slowly.

To reproduce the second skipped scrolling bug (affecting both host and VM):
1. Start Google Chrome/Chromium with `--ozone-platform=X11`.
2. Have something else open that you can ALT+TAB to (Firefox, for example).
3. Go to a web page (https://fedoramagazine.org).
4. Scroll to the middle (so that we have enough space to go up/down).
5. Scroll down, once.
6. Press ALT+TAB, twice. (So Chrome loses and regains focus).
7. Scroll up, once.

Repeating steps 5-7 will results in 0 scrolls. This can also be triggered simply by scrolling to the top of the page, scrolling down once and repeat.
Comment 7 Zamundaaa 2025-06-02 15:51:36 UTC
The Wayland events KWin sends are definitely correct, with
> axis_discrete(0, 1)
or
> axis_discrete(0, -1)
each time.

So this is a bug in the application(s) - please report it to the relevant apps.