Added "Sensitivity" option. Use for slowing down high resolution mice.

This commit is contained in:
Jürgen Appel
2007-04-23 15:54:08 +02:00
committed by Matthias Hopf
parent 4666e5f14b
commit e567cb0792
3 changed files with 32 additions and 1 deletions

View File

@@ -210,6 +210,15 @@ Sets the resolution of the device in counts per inch. Setting this is
only supported for some mice, including some PS/2 mice on some platforms.
Default: whatever the mouse is already set to.
.TP 7
.BI "Option \*qSensitivity\*q \*q" float \*q
Mouse movements are multiplied by this float before being processed. Use this
mechanism to slow down high resolution mice. Because values bigger than 1.0
will result in not all pixels on the screen being accessible, you should better
use mouse acceleration (see
.BR "man xset" )
for speeding up low resolution mice.
Default: 1.0
.TP 7
.BI "Option \*qDragLockButtons\*q \*q" "L1 B2 L3 B4" \*q
Sets \*qdrag lock buttons\*q that simulate holding a button down, so
that low dexterity people do not have to hold a button down at the

View File

@@ -213,7 +213,8 @@ typedef enum {
OPTION_VMIN,
OPTION_DRAGLOCKBUTTONS,
OPTION_DOUBLECLICK_BUTTONS,
OPTION_BUTTON_MAPPING
OPTION_BUTTON_MAPPING,
OPTION_SENSITIVITY
} MouseOpts;
#ifdef XFree86LOADER
@@ -257,6 +258,7 @@ static const OptionInfoRec mouseOptions[] = {
{ OPTION_DRAGLOCKBUTTONS, "DragLockButtons",OPTV_STRING, {0}, FALSE },
{ OPTION_DOUBLECLICK_BUTTONS,"DoubleClickButtons", OPTV_STRING, {0}, FALSE },
{ OPTION_BUTTON_MAPPING, "ButtonMapping", OPTV_STRING, {0}, FALSE },
{ OPTION_SENSITIVITY, "Sensitivity", OPTV_REAL, {0}, FALSE },
{ -1, NULL, OPTV_NONE, {0}, FALSE }
};
#endif
@@ -799,6 +801,12 @@ MouseHWOptions(InputInfoPtr pInfo)
xf86Msg(X_CONFIG, "%s: Resolution: %d\n", pInfo->name,
pMse->resolution);
}
if (mPriv->sensitivity
= xf86SetRealOption(pInfo->options, "Sensitivity", 1.0)) {
xf86Msg(X_CONFIG, "%s: Sensitivity: %g\n", pInfo->name,
mPriv->sensitivity);
}
}
static void
@@ -2365,10 +2373,13 @@ MousePostEvent(InputInfoPtr pInfo, int truebuttons,
int dx, int dy, int dz, int dw)
{
MouseDevPtr pMse;
mousePrivPtr mousepriv;
int zbutton = 0, wbutton = 0, zbuttoncount = 0, wbuttoncount = 0;
int i, b, buttons = 0;
pMse = pInfo->private;
mousepriv = (mousePrivPtr)pMse->mousePriv;
if (pMse->protocolID == PROT_MMHIT)
b = reverseBits(hitachMap, truebuttons);
else
@@ -2458,6 +2469,15 @@ MousePostEvent(InputInfoPtr pInfo, int truebuttons,
dy = tmp;
}
/* Accumulate the scaled dx, dy in the private variables
fracdx,fracdy and return the integer number part */
if (mousepriv) {
mousepriv->fracdx += mousepriv->sensitivity*dx;
mousepriv->fracdy += mousepriv->sensitivity*dy;
mousepriv->fracdx -= ( dx=(int)(mousepriv->fracdx) );
mousepriv->fracdy -= ( dy=(int)(mousepriv->fracdy) );
}
/* If mouse wheel movement has to be mapped on a button, we need to
* loop for button press and release events. */
do {

View File

@@ -64,6 +64,8 @@ typedef struct {
int acc;
CARD32 pnpLast;
Bool disablePnPauto;
float fracdx,fracdy;
float sensitivity;
} mousePrivRec, *mousePrivPtr;
/* mouse proto flags */