Why was WHEEL_DELTA chosen to be 120 instead of a much more convenient value like 100 or even 10?

Raymond Chen


We saw some time ago that the nominal mouse wheel amount for one click (known as a “detent”) is specified by the constant WHEEL_DELTA, which has the value 120.

Why 120? Why not a much more convenient number like 100, or even 10?

Because the value 120 made it easier to create higher-resolution mouse wheels.

As noted in the documentation:

The delta was set to 120 to allow Microsoft or other vendors to build finer-resolution wheels (a freely-rotating wheel with no notches) to send more messages per rotation, but with a smaller value in each message.

Suppose the original wheel mouse had nine clicks around its circumference. Click nine times, and you’ve made a full revolution. (I have no idea how many actual clicks there were, but the actual number doesn’t matter.) Therefore, each click of the wheel on the original mouse resulted in 120 wheel units.

Now, suppose you wanted to build a double-resolution wheel, say one with eighteen clicks around the circumference instead of just nine. If you reported 120 wheel units for each click, then your mouse would feel “slippery”, because it scrolled twice as fast as the original mouse. The solution: Have each click of your double-resolution mouse report 60 wheel units instead of 120.

That’s why the number chosen was 120. The number 120 has a lot more useful factors than 100. The number 100 = 2² × 5² can be evenly divided by the small integers 2, 4, 5, and 10. On the other hand, the number 120 = 2³ × 3 × 5 can be evenly divided by 2, 3, 4, 5, 6, 8, and 10.

If you wanted to build a triple-resolution mouse, and the MOUSE_WHEEL value were 100, then you would have difficulty reporting each click, because you couldn’t just report 33 for each one. (After three clicks, you would have reported only 99 units, and applications which waited for a full MOUSE_WHEEL would still be waiting.) Your mouse driver would have to report 33, 33, 34, 33, 33, 34, 33, 33, 34, and so on. And then it gets messy if the user changes scrolling direction.

On the other hand, if MOUSE_WHEEL were 120, then the triple-resolution mouse could simply report 40 units per click.

Okay, so why 120 instead of just 12?

As noted in the documentation, the value was chosen so that it would be possible to build a mouse with no clicks at all. The wheel simply spun smoothly, and you could stop it at any point. Such a wheel would report one wheel unit for every one-third of one degree of rotation. If the detent were only 12 units, then the wheel would report one unit for every 3 1/3 degrees of rotation, which wouldn’t be as smooth.

I don’t know if anybody has developed such a mouse, but at least the possibility is still there. (There are free-spinning mouse wheels, but I don’t know whether they are normal WHEEL_DELTA wheels just without the mechanical detents, or whether they really do report fine rotational information.)

Bonus reading: The History of the Scroll Wheel, written by its inventor, Eric Michelman.

Mouse wheel trivia: The code name for the mouse wheel project was Magellan. The code name still lingers in error messages that pop up from the original wheel mouse driver.

Raymond Chen
Raymond Chen

Follow Raymond