HumbleUI / JWM

Cross-platform window management and OS integration library for Java
Apache License 2.0
547 stars 44 forks source link

X11: Scrolling amount should be divided by increment #236

Closed dzaima closed 1 year ago

dzaima commented 1 year ago

Scrolling value should be divided by valuator.increment to normalize the scroll amount between operating system configurations, e.g.:

diff --git a/linux/cc/WindowManagerX11.cc b/linux/cc/WindowManagerX11.cc
index e81c41e..1977603 100644
--- a/linux/cc/WindowManagerX11.cc
+++ b/linux/cc/WindowManagerX11.cc
@@ -382,6 +382,7 @@ void WindowManagerX11::_processXEvent(XEvent& ev) {
                                         valuator.previousValue = value;
                                         value = delta;                                                
                                     }
+                                    value /= valuator.increment;
                                     if (valuator.isHorizontal) {
                                         dX = value;
                                     } else {

On an update from Linux Mint 20.3 to 21, I observed the reported scroll value upon a single scroll tick going from 15 to 120, making scrolling 8x faster. valuator.increment previously was 15 and now is 120, so dividing by it would've made the system upgrade correctly not change any program behavior.

Reason for me not yet making a PR is that I don't know what additional scaling should there be. The diff above makes each scroll tick be 1 unit, so there likely would need to be some additional multiplier to behave similarly to Windows/Mac.

tonsky commented 1 year ago

I put 100 for now, seems ~what I observe in other apps