Nicer pointer acceleration code - patch included

Andreas Hartmetz ahartmetz at
Sun Sep 25 18:17:27 PDT 2005

Hi List!

I was dissatisfied with the almost-current (I am using version
"Ubuntu 6.8.2-10.1") mouse acceleration code so I invested some
time to make up a nice polynomial to replace it.
If this particular polynomial doesn't suit you, you can still fiddle
with the coefficients. It might be a good idea to have some computer
algebra package draw a graph of your new function so you know what it does.
Due to the possibility to approximate any function with a Taylor
polynomial, this, besides splines, is the most generic way(*) to
accelerate the mouse pointer. This general approach could also give much
more control over mouse acceleration to user-space programs. Just make
the coefficients variable...
An easy tuning knob for accel strength control is the multiplier in the
accelSeries call.

You might need a good optical mouse for best results as acceleration is
quite aggressive on the fast end.
For people who just apply this patch without reading it: The new code
only kicks in if X's "acceleration threshold" is set to zero.
Okay, if you are interested, please test this patch and comment on it!

Regards, Andreas

(*) Maybe one could also include the previous movement distance and
include (new - old) in the formula. I have not tried this yet. This
could be used to prevent overshooting after fast movements with very
aggressive acceleration.

Patch at
Apply patch in directory xc/programs/Xserver/hw/xfree86/common

More information about the xorg mailing list