diff --git a/usr.sbin/moused/moused.8 b/usr.sbin/moused/moused.8 index 18d1b4dbb334..70d18765e24b 100644 --- a/usr.sbin/moused/moused.8 +++ b/usr.sbin/moused/moused.8 @@ -28,7 +28,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id: moused.8,v 1.15 1998/06/14 20:05:26 ahasty Exp $ +.\" $Id: moused.8,v 1.16 1998/09/17 09:51:15 dwhite Exp $ .\" .Dd December 3, 1997 .Dt MOUSED 8 @@ -45,6 +45,7 @@ .Op Fl S Ar baudrate .Op Fl C Ar threshold .Op Fl m Ar N=M +.Op Fl w Ar N .Op Fl z Ar target .Op Fl t Ar mousetype .Fl p Ar port @@ -275,6 +276,15 @@ For the PS/2 mouse: This is the only protocol type available for the PS/2 mouse and should be specified for any PS/2 mice, regardless of the brand. .El +.It Fl w Ar N +Make the physical button +.Ar N +act as the wheel mode button. +While this button is pressed, X and Y axis movement is reported to be zero +and the Y axis movement is mapped to Z axis. +You may further map the Z axis movement to virtual buttons by the +.Fl z +option below. .It Fl z Ar target Map Z axis (roller/wheel) movement to another axis or to virtual buttons. Valid diff --git a/usr.sbin/moused/moused.c b/usr.sbin/moused/moused.c index c56855ab152f..bc8e16fe2a8d 100644 --- a/usr.sbin/moused/moused.c +++ b/usr.sbin/moused/moused.c @@ -46,7 +46,7 @@ #ifndef lint static const char rcsid[] = - "$Id: moused.c,v 1.19 1998/06/14 20:05:27 ahasty Exp $"; + "$Id: moused.c,v 1.21 1998/11/20 11:17:59 yokota Exp $"; #endif /* not lint */ #include @@ -340,6 +340,7 @@ static struct rodentparam { int rate; /* report rate */ int resolution; /* MOUSE_RES_XXX or a positive number */ int zmap; /* MOUSE_{X|Y}AXIS or a button number */ + int wmode; /* wheel mode button number */ int mfd; /* mouse file descriptor */ int cfd; /* /dev/consolectl file descriptor */ int mremsfd; /* mouse remote server file descriptor */ @@ -356,6 +357,7 @@ static struct rodentparam { rate : 0, resolution : MOUSE_RES_UNKNOWN, zmap: 0, + wmode: 0, mfd : -1, cfd : -1, mremsfd : -1, @@ -407,7 +409,7 @@ main(int argc, char *argv[]) int c; int i; - while((c = getopt(argc,argv,"3C:DF:I:PRS:cdfhi:l:m:p:r:st:z:")) != -1) + while((c = getopt(argc,argv,"3C:DF:I:PRS:cdfhi:l:m:p:r:st:w:z:")) != -1) switch(c) { case '3': @@ -487,6 +489,15 @@ main(int argc, char *argv[]) rodent.baudrate = 9600; break; + case 'w': + i = atoi(optarg); + if ((i <= 0) || (i > MOUSE_MAXBUTTON)) { + warnx("invalid argument `%s'", optarg); + usage(); + } + rodent.wmode = 1 << (i - 1); + break; + case 'z': if (strcmp(optarg, "x") == 0) rodent.zmap = MOUSE_XAXIS; @@ -794,8 +805,8 @@ static void usage(void) { fprintf(stderr, "%s\n%s\n%s\n", - "usage: moused [-3DRcdfs] [-I file] [-F rate] [-r resolution] [-S baudrate] [-C threshold]", - " [-m N=M] [-z N] [-t ] -p ", + "usage: moused [-3DRcdfs] [-I file] [-F rate] [-r resolution] [-S baudrate]", + " [-C threshold] [-m N=M] [-w N] [-z N] [-t ] -p ", " moused [-d] -i -p "); exit(1); } @@ -1620,6 +1631,12 @@ r_map(mousestatus_t *act1, mousestatus_t *act2) lbuttons = 0; act2->obutton = act2->button; + if (pbuttons & rodent.wmode) { + pbuttons &= ~rodent.wmode; + act1->dz = act1->dy; + act1->dx = 0; + act1->dy = 0; + } act2->dx = act1->dx; act2->dy = act1->dy; act2->dz = act1->dz;