davidhi7 / ddcci-plasmoid

KDE Plasma widget to adjust the brightness of multiple external monitors
MIT License
409 stars 12 forks source link

Workaround for high resolution mouse wheel #63

Closed CatEricka closed 7 months ago

CatEricka commented 8 months ago

On Debian 12 and KDE Plasma 5.27.5, the high resolution mouse wheel (for me, it's Logitech M720) may cause the value to be a non-integer number.

This may be a bug, but considering that the backend only supports integers, this should be works.

CatEricka commented 8 months ago

Before this patch:

图片

plasma-ddcci-backend set-brightness: error: argument brightness: invalid int value: '68.5'

After:

图片

The high resolution mouse wheel support may be fixed upstream in the future, so just doing defensive programming would be good enough.

davidhi7 commented 7 months ago

Just have been able to reproduce this, but also using a regular mouse wheel and only after switching to Plasma 6.

I think when rounding this we should take the step size into account by dividing by the step size, rounding and multiplying by the step size again.

I hope I will be able to merge this in the coming days.

CatEricka commented 7 months ago

https://invent.kde.org/plasma/libplasma/-/commit/aea3d4b131070d8388edf84c9c2a32f7b4203617

CatEricka commented 7 months ago

I'm researching if there is a better solution...