Last time, we implemented a basic autoscroller. But you may have noticed an odd side effect: Wiggling the mouse speeds up the scrolling.
This happens because each wiggle of the mouse generates a new WM_
message, and that in turn triggers the “activate autoscroll” code, which causes an autoscroll to happen ahead of its normal schedule. As a result, wiggling the mouse makes autoscrolling go faster.
If you wanted to remove this effect, you would have to reduce the amount of scrolling based on how much time has elapsed since the most recent autoscroll. The autoscroll timer runs at 100ms (assuming a default double-click speed of 500ms), and if the mouse move message is generated after, say, 25ms, then the autoscroll should move only a quarter of its usual distance, rather than the full distance. That way, the all the intermediate adjustments have a cumulative distance equivalent to the single adjustment at the end of the tick.
Another way of fixing this is simply to ignore mouse motion once the autoscroll timer is active. The timer is firing every tenth of a second. That’s plenty fast enough to fall below a human being’s response perception for something that isn’t a click or keypress.
But I suspect this behavior, even though technically incorrect, is something developer leave in because users like it. Wiggling the mouse to make something scroll faster makes it feel like the computer is responding to your impatience by hurrying. And users like that.
A discovered bug is now a feature. (obXKCD.)
Next time, we’ll look at a different autoscrolling algorithm.
I’ve been wiggling the mouse to make scrolling go faster in various programs for decades. I don’t think I ever really thought about why it does that. 🤔 It’s just like how I’ve always intuitively strafe-run in video-games without thinking about the underlying code. 🤷
In some programs, I use the scroll-wheel to scroll faster while dragging stuff than the auto-scroll will go on its own.
Bug dependence stinks. https://superuser.com/q/1620933/71189 The horror it’s just too much.
Sometimes when selecting text on a page you need to wiggle the mouse to scroll at all. Select and drag, it scrolls for a bit and then suddenly stops. Beyond that point you need to constantly wiggle the mouse to get the scrolling to continue.
Indeed. That’s so much pain to select multi-page text without wiggling your mouse.
The wiggle-to-scroll-faster “feature” is helpful as a workaround for the lack of an intended way to speed up the scroll, but you could be nicer and give the users more control by calibrating the scroll speed to how far outside the area they’ve moved the mouse.
Bonus points if you can somehow detect that they’re trying to move down further even if the mouse is actually at the bottom of the screen already!