lispgames / glop

Direct FFI bindings for OpenGL window and context management
MIT License
67 stars 14 forks source link

Mapping Mouse Wheel Scrolling to Buttons is Inadequate #22

Open Shinmera opened 7 years ago

Shinmera commented 7 years ago

Mapping a mouse wheel scroll event to a single mouse button press event is inadequate, as it does not convey the distance by which the wheel was turned. Under some conditions the system will report a single scroll event for more than a single tick, or report an event for less than a tick. In effect this means that Glop forces applications to lose scrolling precision, which might be quite unfavourable for certain types of applications.

A proper handling of this case would introduce an additional event type that has a delta attribute that determines the number of ticks scrolled.

patzy commented 7 years ago

Which platform are you talking about? Looking over the code it seems xlib only provides button events for mouse wheel, on win32 it looks like there's a mouse wheel event, not sure how osx handle this. On xorg glop just process whatever is available as a next event so I'm not sure how it 'misses' scroll events.

Shinmera commented 7 years ago

Windows for one provides an interface like I described out of the box and Glop dumbs it down. Xlib 2.1+ also provides "high resolution scrolling" which could be used for better scrolling information. See here

patzy commented 7 years ago

The link you provided is for XInput which afaik is an extension. 3b did some work on XI2 support here https://github.com/3b/glop/tree/xi2-rebased if you want to try it. I don't have the time or interest to add such an extension at the moment but feel free to hack it and send a pull request. Windows support should be easy, as you said the event is already here, just hidden. Problem is you'll want to provide a consistent interface and behavior for all platforms.