Changing Mouse sensitivity
Matthias Hopf
mhopf at suse.de
Tue Apr 17 09:01:00 PDT 2007
On Apr 16, 07 23:43:02 -0600, Jürgen Appel wrote:
> Since the big google did not find any solution, and since the original code
> was open source and quite well written, I decided to take the matter
Woha... You're probably the only one thinking this piece of ... code is
well written ;-)
> + if (mPriv->sensitivity
> + = xf86SetRealOption(pInfo->options, "Sensitivity", 1)) {
Best indicate float here with 1.0. Due to prototypes this won't change
resulting code, but it helps reading it.
> + xf86Msg(X_CONFIG, "%s: Sensitivity: %g\n", pInfo->name,
> + mPriv->sensitivity);
IMHO unnecessary. But matter of personal taste.
> @@ -2350,8 +2358,9 @@
> MouseDevPtr pMse;
> int zbutton = 0, wbutton = 0, zbuttoncount = 0, wbuttoncount = 0;
> int i, b, buttons = 0;
> -
Unnecessary whitespace change. Also having an empty line after variable
declarations is pretty standard.
> @@ -2441,6 +2449,14 @@
> dy = tmp;
> }
>
> + /* Accumulate the scaled dx, dy in the private variables sumdx,sumdy and
> return the integer number part */
Lines IMHO shouldn't exceed column 78, especially comments which can be
easily formated in multiple lines.
> + if (mousepriv) {
I suggest only running in this part if sensitivity != 1. e.g.
+ if (mousepriv && mousepriv->sensitivity != 1.0)
But you can convince me that this is bad practice if you wish to ;)
> + mousepriv->sumdx-=(dx=(int)(mousepriv->sumdx));
Some spaces here, please. e.g.
+ mousepriv->sumdx -= (dx = (int)(mousepriv->sumdx));
> diff -Naur xf86-input-mouse-1.1.2/src/mousePriv.h
> xf86-input-mouse-1.1.2.ja2/src/mousePriv.h
> --- xf86-input-mouse-1.1.2/src/mousePriv.h 2006-10-11
> 16:23:54.000000000 -0600
> +++ xf86-input-mouse-1.1.2.ja2/src/mousePriv.h 2007-04-02
> 04:56:42.000000000 -0600
> @@ -64,6 +64,8 @@
> int acc;
> CARD32 pnpLast;
> Bool disablePnPauto;
> + double sumdx,sumdy;
> + double sensitivity;
Hm. I think float would be good enough in this case. This won't change
much on PC hardware, but I don't like wasting resources unnecessarily
when things might be compiled on an embedded platform as well.
Please think about these issues, I'll happily apply an updated patch.
CU
Matthias
--
Matthias Hopf <mhopf at suse.de> __ __ __
Maxfeldstr. 5 / 90409 Nuernberg (_ | | (_ |__ mat at mshopf.de
Phone +49-911-74053-715 __) |_| __) |__ R & D www.mshopf.de
More information about the xorg
mailing list