feschber / lan-mouse

mouse & keyboard sharing via LAN
GNU General Public License v3.0
2.07k stars 55 forks source link

Mouse wheel distance/speed #133

Open xf- opened 1 month ago

xf- commented 1 month ago

Still broken - build the client and server on latest main commit

Server & client Wayland to Wayland

Fixed - inverted scroll direction

feschber commented 1 month ago

What desktop? KDE?

xf- commented 1 month ago

What desktop? KDE?

Yes on both. Like I wrote in the other issue, reverting the change helps.

feschber commented 1 month ago

I've tried pretty much anything but unfortunately there seems to be a bug with the KDE remote desktop portal implementation.

It might just be that they report 0 discrete scroll steps here: https://invent.kde.org/plasma/kwin/-/blame/master/src/backends/fakeinput/fakeinputbackend.cpp#L153

Basically there is two kinds of scroll events: Axis and AxisDiscrete120. Axis is for touchpads and given in pixels, while AxisDiscrete120 is given in wheelsteps with each step being equal to 120 in value.

Now the xdg-desktop-portal-kde, which is being used here calls to the fake_input protocol: https://invent.kde.org/plasma/xdg-desktop-portal-kde/-/blob/master/src/remotedesktop.cpp?ref_type=heads#L322 https://invent.kde.org/plasma/xdg-desktop-portal-kde/-/blob/master/src/waylandintegration.cpp?ref_type=heads#L414 while translating discrete scroll events into fakeinput "Axis" events which are handled in kwin:

https://invent.kde.org/plasma/kwin/-/blame/master/src/backends/fakeinput/fakeinputbackend.cpp#L132

Kwin calls to pointerAxisChanged while setting discrete Scrolling steps to 0...

So all of this seems to be fundamentally broken in KWIN itself and I fear there is nothing I can do right now to fix it.

I will however make sure to report it upstream

xf- commented 1 month ago

THX for your work. I still have my patched build and it works.

feschber commented 1 month ago

THX for your work. I still have my patched build and it works.

It's not perfect though, right? In firefox, at least from my testing it always jumped around a bit and did not scroll smoothly (instead jumping to the next possition directly). Regardless, I can see if I can replicate the behaviour to what your patch looks like as closely as possible.

Do you mean the state before e21ab02a6e752d39ddcf73ceb9c8e5e50d014923 or the current master with e21ab02a6e752d39ddcf73ceb9c8e5e50d014923 reverted?

xf- commented 1 month ago

THX for your work. I still have my patched build and it works.

It's not perfect though, right? In firefox, at least from my testing it always jumped around a bit and did not scroll smoothly (instead jumping to the next possition directly). Regardless, I can see if I can replicate the behaviour to what your patch looks like as closely as possible.

Do you mean the state before e21ab02 or the current master with e21ab02 reverted?

Yeah, it is more or less the old function. It inverts the scrolling, but the speed is normal. So no 120 implementation. I use current release with reverting to this without 120 https://github.com/feschber/lan-mouse/commit/e21ab02a6e752d39ddcf73ceb9c8e5e50d014923#diff-c04e25924525b7dc3115df2f79d08fd1eecbbd91bf16f575fcba89e885205f05L737-L772