Index: moused.8 =================================================================== RCS file: /usr/home/ncvs/src/usr.sbin/moused/moused.8,v retrieving revision 1.33 diff -u -r1.33 moused.8 --- moused.8 2001/02/01 16:43:51 1.33 +++ moused.8 2001/06/25 18:29:06 @@ -38,11 +38,12 @@ .Nd pass mouse data to the console driver .Sh SYNOPSIS .Nm -.Op Fl DPRcdfs +.Op Fl DPRacdfs .Op Fl I Ar file .Op Fl F Ar rate .Op Fl r Ar resolution .Op Fl S Ar baudrate +.Op Fl a Ar X Ns Op , Ns Ar Y .Op Fl C Ar threshold .Op Fl m Ar N=M .Op Fl w Ar N @@ -153,6 +154,12 @@ .It Fl S Ar baudrate Select the baudrate for the serial port (1200 to 9600). Not all serial mice support this option. +.It Fl a Ar X Ns Op , Ns Ar Y +Accelerate or decelerate the mouse input. +This is a linear acceleration only. +Values less than 1.0 slow down movement, values greater than 1.0 speed it +up. +Specifying only one value sets the acceleration for both axes. .It Fl c Some mice report middle button down events as if the left and right buttons are being pressed. Index: moused.c =================================================================== RCS file: /usr/home/ncvs/src/usr.sbin/moused/moused.c,v retrieving revision 1.48 diff -u -r1.48 moused.c --- moused.c 2001/02/18 10:43:50 1.48 +++ moused.c 2001/06/24 18:05:51 @@ -382,6 +382,8 @@ long button2timeout; /* 3 button emulation timeout */ mousehw_t hw; /* mouse device hardware information */ mousemode_t mode; /* protocol information */ + float accelx; /* Acceleration in the X axis */ + float accely; /* Acceleration in the Y axis */ } rodent = { flags : 0, portname : NULL, @@ -398,6 +400,8 @@ mremcfd : -1, clickthreshold : DFLT_CLICKTHRESHOLD, button2timeout : DFLT_BUTTON2TIMEOUT, + accelx : 1.0, + accely : 1.0, }; /* button status */ @@ -502,7 +506,7 @@ for (i = 0; i < MOUSE_MAXBUTTON; ++i) mstate[i] = &bstate[i]; - while((c = getopt(argc,argv,"3C:DE:F:I:PRS:cdfhi:l:m:p:r:st:w:z:")) != -1) + while((c = getopt(argc,argv,"3C:DE:F:I:PRS:a:cdfhi:l:m:p:r:st:w:z:")) != -1) switch(c) { case '3': @@ -518,6 +522,18 @@ } break; + case 'a': + i = sscanf(optarg, "%f,%f", &rodent.accelx, &rodent.accely); + if (i == 0) { + warnx("invalid acceleration argument '%s'", optarg); + usage(); + } + + if (i == 1) + rodent.accely = rodent.accelx; + + break; + case 'c': rodent.flags |= ChordMiddle; break; @@ -919,8 +935,8 @@ if (action2.flags & MOUSE_POSCHANGED) { mouse.operation = MOUSE_MOTION_EVENT; mouse.u.data.buttons = action2.button; - mouse.u.data.x = action2.dx; - mouse.u.data.y = action2.dy; + mouse.u.data.x = action2.dx * rodent.accelx; + mouse.u.data.y = action2.dy * rodent.accely; mouse.u.data.z = action2.dz; if (debug < 2) ioctl(rodent.cfd, CONS_MOUSECTL, &mouse); @@ -928,8 +944,8 @@ } else { mouse.operation = MOUSE_ACTION; mouse.u.data.buttons = action2.button; - mouse.u.data.x = action2.dx; - mouse.u.data.y = action2.dy; + mouse.u.data.x = action2.dx * rodent.accelx; + mouse.u.data.y = action2.dy * rodent.accely; mouse.u.data.z = action2.dz; if (debug < 2) ioctl(rodent.cfd, CONS_MOUSECTL, &mouse); @@ -986,8 +1002,8 @@ { fprintf(stderr, "%s\n%s\n%s\n", "usage: moused [-DRcdfs] [-I file] [-F rate] [-r resolution] [-S baudrate]", - " [-C threshold] [-m N=M] [-w N] [-z N] [-t ]", - " [-3 [-E timeout]] -p ", + " [-a X [,Y]] [-C threshold] [-m N=M] [-w N] [-z N]", + " [-t ] [-3 [-E timeout]] -p ", " moused [-d] -i -p "); exit(1); }