macOS: OnMouseWheel is less precise than it is on Windows, leading to bad scrolling behavior
Original Reporter info from Mantis: danlehmann
-
Reporter name: Daniel
Original Reporter info from Mantis: danlehmann
- Reporter name: Daniel
Description:
In the old times, MouseWheel only passed WheelDelta of -120 / +120 to applications. This was fine for old-fashioned mouse-wheels, but isn't sufficient for modern trackpads and some modern mouse wheels.
Windows nowadays gives more fine grained values to applications, making scrolling a lot smoother (if supported by hardware). This works well in Lazarus. onMouseWheel gives values to applications that sometimes go down to a single increment, allowing pixel-perfect scrolling.
On macOS, good scrolling hardware is much more widespread, but unfortunately it seems like the FCL turns the nice events into just -120/+120. I assume this was done for compatibility with code written for Windows, but given that Windows itself has moved on from coarse events, I think it would be a good idea to also use the finer events on macOS. This would make scrolling feel a lot better.
Sample videos:
- macOS: https://youtu.be/7M21AecxM8Y
- Windows: https://youtu.be/b_2IgWjeWcY
Steps to reproduce:
Run the attached sample project on Windows and macOS. Notice how it scrolls pretty well on Windows (given the right hardware) but poorly on macOS:
- No pixel-perfect scrolling
- Scrolling is generally too fast, unless...
- ...we scroll REALLY fast, in which case maximum scrolling speed is too low
Notice in particular how WheelDelta is never anything else than +/- 120.
Additional information:
- This also affects the Lazarus IDE itself. Scrolling is quite poor on macOS.
- If anyone wants to reproduce this on Windows, note that driver support is spotty:
* Microsoft Precision Touchpads work well (I tried a Surface Pro X which works perfectly)
* Logitech mice (e.g. MX Master 3) support fine events but their drivers don't seem to hand them out (unless they rename themselves to Firefox.exe :-) ).
Regardless of spotty driver support, Windows apps have to be able to deal with values <>120 as they will get those values on some systems.
Mantis conversion info:
- Mantis ID: 38205
- OS: macOS
- OS Build: 11 Big Sur
- Build: 2020-07-07
- Version: 2.0.10
- Monitored by: » mftq75 (C Western), » danlehmann (Daniel)