diff --git a/man/evdev.man b/man/evdev.man index 530f979..f34d19c 100644 --- a/man/evdev.man +++ b/man/evdev.man @@ -71,6 +71,11 @@ enabled. Default: 50. .BI "Option \*qReopenAttempts\*q \*q" integer \*q Number of reopen attempts after a read error occurs on the device (e.g. after waking up from suspend). In between each attempt is a 100ms wait. Default: 10. +.TP 7 +.BI "Option \*qSensitivity\*q \*q" float \*q +Multiply mouse movements by this number. Can be used to slow the mouse down +(by specifying a number between 0.0 and 1.0), or to speed the mouse up (by +specifying a number greater than 1.0). Default: 1.0 .SH AUTHORS Kristian Høgsberg. diff --git a/src/evdev.c b/src/evdev.c index c0fe244..fc732f7 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -360,8 +360,18 @@ EvdevReadInput(InputInfoPtr pInfo) } } - if (dx != 0 || dy != 0) + if (dx != 0 || dy != 0) { + + /* Adjust for mouse sensitivity. */ + pEvdev->fracx += dx * pEvdev->sensitivity; + dx = (int)pEvdev->fracx; + pEvdev->fracx -= dx; + pEvdev->fracy += dy * pEvdev->sensitivity; + dy = (int)pEvdev->fracy; + pEvdev->fracy -= dy; + xf86PostMotionEvent(pInfo->dev, FALSE, 0, 2, dx, dy); + } /* * Some devices only generate valid abs coords when BTN_DIGI is @@ -1272,6 +1282,9 @@ EvdevPreInit(InputDriverPtr drv, IDevPtr dev, int flags) */ pEvdev->tool = 1; + pEvdev->sensitivity = xf86SetRealOption(pInfo->options, "Sensitivity", 1.0); + xf86Msg(X_CONFIG, "%s: Sensitivity: %f\n", pInfo->name, pEvdev->sensitivity); + device = xf86CheckStrOption(dev->commonOptions, "Path", NULL); if (!device) device = xf86CheckStrOption(dev->commonOptions, "Device", NULL); diff --git a/src/evdev.h b/src/evdev.h index 9f16b81..2f69735 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -83,6 +83,10 @@ typedef struct { long abs_bitmask[NBITS(ABS_MAX)]; long led_bitmask[NBITS(LED_MAX)]; struct input_absinfo absinfo[ABS_MAX]; + + /* Mouse sensitivity. */ + float sensitivity; + float fracx, fracy; } EvdevRec, *EvdevPtr; /* Middle Button emulation */