Scroll up and down both return 0
Status: Beta
Brought to you by:
razzfazz
Scrolling slowly up or down can both return 0 from -[NSEvent deltaY]. The result is that scrolling down slowly is misinterpreted as scrolling up. Other drivers can return 0 for scrolling up but always return a negative number for scrolling down.
I've attached an Xcode project for a simple program that displays deltaY values. Just scroll in the blank part of the window.
Simple program to display -[NSEvent deltaY] values
Why would (or should) a delta of 0 lead to any scrolling at all?
"Why would (or should) a delta of 0 lead to any scrolling at all?"
I think a better question would be "Why does the driver return a value of 0 when the scroll wheel is moved?" I think it should either return a positive or negative value. (Please note I no longer have a PowerPC computer, so if no one else cares about this issue you shouldn't waste any time working on it.)
I'm guessing this is a result of the raw trackpad inputs being scaled and then rounded to an integer; I guess it shouldn't be too hard to add some code that suppresses scroll events with zero delta...
Ah, turns out I actually do check for zero deltas, and only generate an event when at least one of the (enabled) axes has a non-zero delta. Since dispatchScrollWheelEvent handles both axes simultaneously, I guess you could still see zero deltas for one axis if there is a non-zero delta on the other one. Not sure what to do about that, though -- like I said, dispatchScrollWheelEvent requires me to specify deltas for all axes every time...