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

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.

Comments (35)
  1. Nick says:

    Useless anecdotal evidence: I'm using a Microsoft Comfort Optical Mouse 3000. It has a smooth-scrolling wheel. A quick .net WinForms scratch program that handles MouseWheel on a ListBox and adds the Delta to the list shows by observation that the mouse won't report wheel movement until it reaches a delta of 30, but seems to have fairly high resolution beyond that. Maybe not single points of delta (my sample size is small), but at least in the two to three-point range. The driver will also happily report very large numbers when you scroll very quickly (I got it as high as 3462 in a single event).

  2. Dan Bugglin says:

    My mouse has a "free wheeling" mechanical switch that basically stops the mouse wheel from clicking into place so I can just flick it and it keeps scrolling by itself.  But it does not increase the resolution, it just makes it scroll faster.

  3. Miff says:

    One mouse of mine has a very slippery wheel, but I think it just sends more then 120 clicks per revolution because it's nearly useless for gaming.

  4. Adam Rosenfield says:

    The ZoneAlarm link doesn't seem to work anymore, and the Wayback machine doesn't have it in its archives.

  5. Rick C says:

    http://www.zonealarm.com/…/55723-Windows-Shut-down-message-Magellan-MSWHEEL seems to be the replacement ZoneAlarm link.

    [Yup. Thread 55723. -Raymond]
  6. Kai Schätzl says:

    I hate the new mice with free-spinning wheel. I think they are a step back from the "click wheel". With the click wheel I could "blindly" scroll a screenful/windowful/scrollbar button range/one "page" just by moving the wheel with minimum effort to the next click. This was a clearly defined and easily reproducable action. With no click you have to scroll much more careful and look at the screen closely, often enough scrolling back and forth until the correct view is reestablished. The free spinning just made working with a mouse wheel slower over all :-(

    The free scrolling wheels are also harder to press (for a real third button click) because the wheel tends to "wheel away" slightly much earlier than with a "click wheel". I would love to see Microsoft release some click-wheel mice again.

  7. Shane Ebersole says:

    Why is the unit of rotation cap at 40 degrees? Is this a math error, or is there some reason behind that?

  8. Random832 says:

    Why does a higher-resolution mouse wheel necessarily need to be an even divisor of the normal click distance?

    Why not have it like "The normal value is 100, or I can get a mouse with slightly smaller clicks that are 80, or get one with significantly smaller ones that are 30"?

    The logical thing would be to have defined the total wheel amount for a full revolution of the wheel – or per inch of wheel motion, for that matter? Or allow it to be tuned by the user.

    """Such a wheel would report one wheel unit for every one-third of one degree of rotation. """

    Is this defined somewhere? If there are meant to be 1080 units in a full revolution, then shouldn't my mouse, which has 24 clicks, have 45 units per click instead of 120? Did the original intellimouse have only nine clicks in a full revolution?

  9. Random832 says:

    Oh. I saw, too late, that your use of the number 9 was only an example, and your use of "one third of one degree" followed from that. Sorry for my mistake.

    The rest of the question still stands. If it were 100, then one with about three times as many clicks (per rotation or per inch, whichever works better for user experience) could simply report 33 units, or 30 or 35 even, without significantly affecting the user's perception of how far it scrolls for a given amount of finger motion.

  10. Nick says:

    @Random832: So, basically, every click scrolls the list box, Excel spreadsheet, text editor, etc., one item except sometimes it doesn't scroll at all or scrolls two items. Nice user experience.

  11. It's funny that you bring up divisibility by small numbers in a smooth-scrolling context, because mathematically such numbers are called "smooth numbers."


    This is also the reason there are 12 hours in a day, and minutes in an hour, etc.

    Why are there 13 donuts in a dozen? Maybe because the person who gets the donuts is expected to eat one on the way back.

  12. SmittyBoy says:

    How about….. because it's a circular measurement, and working in radians would be a pain.

    Anybody with a clue knows when working with wheels you use a number divisible by 12, and to use 360 would be overkill.

    See @Maurits post if you're still confused.

  13. mikeb says:

    Note that the Babylonians used a base 60 number system. Like the mouse wheel API designers, it's thought that having so many simple factors was a major reason (from en.wikipedia.org/…/Babylonian_numerals):

    "A common theory is that 60, a superior highly composite number (the previous and next in the series being 12 and 120), was chosen due to its prime factorization: 2×2×3×5, which makes it divisible by 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, and 30. In fact, it is the smallest integer divisible by all integers from 1 to 6"

  14. Barrie Dempster says:

    This is very similar to the reasons for switching to a Duodecimal ( en.wikipedia.org/…/Duodecimal ) system which was recently covered in an io9 article ( io9.com/duodecimal-system )

  15. Random832 says:

    @Nick: So, basically, every click scrolls the list box, Excel spreadsheet, text editor, etc., one item except sometimes it doesn't scroll at all or scrolls two items. Nice user experience.

    I think that every wheel event of a given value should be the same amount of physical scrolling down to a minimum. So, if a normal event (100 units in my model) scrolls three items, then: any amount between 84 and 116 should scroll three items, any amount between 50 and 83 should scroll two items, and any amount below 50 should scroll one item (maybe some amount should be chosen below which it takes multiple clicks to scroll an item, to allow for that "continuous wheel" case Raymond mentioned, but you don't seem to like "sometimes it doesn't scroll at all")

  16. Mark S says:

    @Random832: what problem are you trying to solve by using 100 instead of 120?

  17. Andreas Rejbrand says:

    I have the Microsoft Touch Mouse (the expensive one designed specifically for Windows 7), and I think it does support 'smooth' scrolling.

  18. Jules says:

    Interestingly, I saw that Raymond had answered this exact question on Stack Overflow a few hours ago (I mean, that's when I noticed it, not when he answered it, which was actually quite a while ago)… which is a fun coincidence of timing. :)


  19. Poptart says:

    "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"

    Your post is very timely for me since I've been mucking around with mouse scrolling code the past few days.

    Anyway I just wanted to say that there are definitely mice with free-spinning wheels that report smaller values, as I'm using the MS Wireless IntelliMouse Explorer 2.0 which reports in increments of 30.

    And I have to say that it's a total pain in the butt to use. Until the recent coding I've done, I never understood exactly why, but now I see that I have to spin it quicker in order to hit that magical value of 120, which Windows and a lot of programs seem to require in order to scroll through a listbox, for example.

    As it is, this mouse is simply unable to move through items one at a time. Either nothing at all happens, or I end up scrolling 3 or 4 items at a time. Trying to click the wheel is also annoying, as Kai Schätzl has mentioned.

  20. alegr1 says:

    It's a shame Microsoft can't get their own Internet Explorer working properly with their own Intellimouse software already for 3 major versions of each software. The first complaints of excessively fast scrolling date back to 2006 or so, and Intellimouse I tried to install from Windows Update still didn't cohabitate well with IE.

    Yes, this is related to the topic because MS mouse will send more messages, and IE may not know what to do with them.

    [There's no need to call out every glass house you see. -Raymond]
  21. John Doe says:

    The number 360 would actually make perfect sense for a full revolution, or a multiple of it.

    How much resolution do you ever need in a mouse wheel, anyway? Remember, we're talking about mouse wheels, not wheels in general.

    The first generations of MS IntelliMouse mice have 18 stops. That makes each stop be 20°, so each delta implies a ~3.99 millimeter movement on a wheel with 1 inch diameter (25.4 millimeter). A full rotation currently implies an accumulated value of 2160.

    A high precision wheel that would report every degree (probably a freely-rotating wheel with no notches) implies a ~0.22 millimeter on a wheel with 1 inch diameter (25.4 millimeter). A degree implies WM_MOUSEWHEEL with a value of 6.

    If some users already move the wheel when they're trying to click it with 18 stops, such as the first generations of Microsoft's IntelliMouse, or a free wheel with 4 times that resolution, such as the "MS Wireless IntelliMouse Explorer 2.0", imagine the trouble that such a high resolution would cause.

    Having a full rotation constant would make the opportunity for wheels with a bump, so you'd know you've rotated the wheel a full 360°, which could be made equivalent to a <kbd>Page-Down</kbd>. Only wheels that rotate exactly 360° (on the notches or freely) should have a bump.

    The user could then choose from the already available options, which are to scroll a number of lines or a full screen per notch, and a new one, which would be to scroll a fraction of the screen per notch where the number of notches per 360° would scroll a full screen.

  22. Gabe says:

    John Doe: Who cares about a whole revolution of the mouse wheel? If it was a knob, then a single revolution would be a useful unit. In the case of a wheel where only part of it is exposed, there's no meaning to "a full revolution".

  23. Joshua says:

    I encountered a mouse that had 3 buttons where the wheel was. Anybody want to guess what the buttons did?

  24. Daniel Schealler says:

    A very succinct and quick overview of duodecimal/dozenal by Dr. James Grimes: http://www.youtube.com/watch

  25. Henri Hein says:

    I find the general obsession with 10-based numbers annoying, so I get thrilled whenever I see someone choosing a number based on reason, rather than rote.  120 makes perfect sense to me, for the reasons you mention.  I don't find 100 or 10 more convenient, just more traditional.

  26. Leo Davidson says:

    A fun thing you can do with the free-spinning mice (at least with some drivers and/or applications; the bug is potentially in both) is spin the wheel so fast that the delta value overflows and the scroll direction reverses.

    (And it's much easier than you might think. I used to run into it all the time when trying to quickly scroll to the bottom of a long document.)

  27. Roastbeef says:

    Totally useless trivia: When the original wheel mice came out there was a lot of pressure for OS/2 to support them, but the PM GUI (Presentation Manager) folks couldn't get their act together on how to implement the support.  Instead the device driver guys modified the mouse driver to inject up-arrow/down-arrow and page-up/page-down keystrokes when the wheel was spun.

  28. @Nick: "So, basically, every click scrolls the list box, Excel spreadsheet, text editor, etc., one item except sometimes it doesn't scroll at all or scrolls two items. Nice user experience."

    I think Random832 was just saying if the WHEEL_DELTA was 100 and a click was to scroll a third of that, then just use a fixed value of 33.  Who would notice that a full revolution doesn't quite scroll a full revolution?  The behavior you describe would only happen if it scrolled 33, 33, then 34, then 33, 33, 34, etc.  If it was just fixed 33, 33, 33, etc. I don't see how anyone would notice the rounding error.

    [Many applications do not have proportional wheel response. (This makes sense if the action is discrete. For example, maybe the slider has only 4 positions, so the app waits until the full detent before moving the slider to the next notch.) Result: You click 3 times, and nothing happens. Then you click a 4th time and the slider moves. But keep clicking, and the slider moves on the 3rd additional click. -Raymond]
  29. The Wheelmaster says:

    Magellan: It scrolls around the world.

  30. Dan says:

    Or, MOST of the way around the world until it gets speared to death by Philippine natives.

  31. Yuhong Bao says:

    Roastbeef: Of course, this was after MS had moved away from OS/2 (I won't flame the entire story here).

  32. Henri Hein says:

    Daniel: that was indeed a great video.  Thanks!

  33. John Doe says:

    @Gabe, you're right, who cares about full revolution?

    But I have another reason against my own first line of thought, in hindsight. A full revolution equivalent to a page down sounded right to me, along with the fraction-of-a-revolution (per-notch), but I was thinking only about tall windows. Also, the usability experience of different scrolling distances for different window heights is, well, annoying at the very least, just like an accelerated scrolling.

    [Why should it depend on the radius of the wheel? (I have to flick only five times for a small wheel, but ten times for a larger wheel.) I would think it should depend on the distance traveled along the circumference. -Raymond]
  34. Brian_EE says:

    "[Why should it depend on the radius of the wheel? (I have to flick only five times for a small wheel, but ten times for a larger wheel.) I would think it should depend on the distance traveled along the circumference. -Raymond]"

    Wait, doesn't the circumference depend on the radius? Oh, and can someone tell me which way to nitpicker's corner?

  35. John Doe says:

    @Raymond, I assume you meant "Why should it depend on the <u>rotation</u> of the wheel?"

    The notion of depending on the circumference is interesting. However, the idea of scrolling a fraction of the scroll bar is, as I think of it, always a flawed UX, no matter if it's based on wheel rotation or wheel circumference.

    [I suspect most people expect the amount of scrolling to be based on the distance traveled along the circumference (as if the wheel were in contact with the ground and rolled away) rather than based on the amount of rotation. -Raymond]

Comments are closed.

Skip to main content