Saturday, August 8, 2020

Setting an arbitrarily precise mouse sensitivity

The Mouse Properties dialog has a slider with discrete tick marks for setting the mouse sensitivity. The MouseSensitivity value in HKCU\Control Panel\Mouse has twice the resolution but is still an integer, with a range from 1 to 20. The mapping of that number to sensitivity multiplier is tabulated here.

It is possible to set an arbitrarily precise sensitivity scale by taking advantage of the SmoothMouseXCurve and SmoothMouseYCurve values, which are consulted when "enhance pointer precision" is on. These are explained in great depth in this article, but in summary they are a set of points that describe a piecewise linear function of physical mouse speed to pointer speed. If the curve is changed to a straight line, the fancy pointer-precision-enhancing effect is disabled: a mouse movement's distance alone, not speed, determines the pointer movement distance. Since the curve points are 16.16 fixed-point values, there are far more than 20 options for the slope. Starting from a curve equivalent to the default sixth tick (provided by this site)...

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Control Panel\Mouse]
"SmoothMouseXCurve"=hex:\
    00,00,00,00,00,00,00,00,\
    C0,CC,0C,00,00,00,00,00,\
    80,99,19,00,00,00,00,00,\
    40,66,26,00,00,00,00,00,\
    00,33,33,00,00,00,00,00
"SmoothMouseYCurve"=hex:\
    00,00,00,00,00,00,00,00,\
    00,00,38,00,00,00,00,00,\
    00,00,70,00,00,00,00,00,\
    00,00,A8,00,00,00,00,00,\
    00,00,E0,00,00,00,00,00

...all Y values can be multiplied or all X values can be divided by the sensitivity multiplier of choice. Only the first 4 bytes of each line matter, and they're in little-endian. A logoff/logon cycle may be necessary for the change to take effect.

Based on my Super User answer.

No comments:

Post a Comment