Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Apr 2000 14:50:53 +0900
From:      Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
To:        "Sean O'Connell" <sean@stat.Duke.EDU>, "Robert Watson" <robert@cyrus.watson.org>
Cc:        FreeBSD stable <freebsd-stable@freebsd.org>, yokota@zodiac.mech.utsunomiya-u.ac.jp
Subject:   Re: middle mouse button emulation broken 
Message-ID:  <200004170550.OAA26290@zodiac.mech.utsunomiya-u.ac.jp>
In-Reply-To: Your message of "Fri, 14 Apr 2000 16:48:59 -0400." <20000414164859.G18075@stat.Duke.EDU> 
References:  <20000414164859.G18075@stat.Duke.EDU> 

next in thread | previous in thread | raw e-mail | index | archive | help

>I'd like to report a "Me too" on Robert Watson's report of 
>middle mouse emulation breakage under X.  I just updated a
>laptop (touchpad with 2 button mouse) running 4.0-RELEASE
>to 4.0-STABLE using sources cvsup'd this morning.
[...]

# Sorry for not replying earlier.  I have been out of town for a week.

There was a couple of fixes in the -CURRENT branch.  They have not
been MFCed to -STABLE yet.  Please apply the following patch to
/usr/src/usr.sbin/moused/moused.c.

Also, try reducing the timeout value for the 3 button emulation.  The
default value is 200 msec after the patch (it was 500 msec before the
patch).  The value determines the duration during which you have to
keep pressing the button before moused reports that the button is
being pressed.

You may feel comfortable with the timeout value of 100 msec or less.

Kazu

Index: moused.c
===================================================================
RCS file: /src/CVS/src/usr.sbin/moused/moused.c,v
retrieving revision 1.42
retrieving revision 1.44
diff -u -r1.42 -r1.44
--- moused.c	2000/03/31 12:35:33	1.42
+++ moused.c	2000/04/11 11:09:39	1.44
@@ -76,7 +76,7 @@
 #define MAX_CLICKTHRESHOLD	2000	/* 2 seconds */
 #define MAX_BUTTON2TIMEOUT	2000	/* 2 seconds */
 #define DFLT_CLICKTHRESHOLD	 500	/* 0.5 second */
-#define DFLT_BUTTON2TIMEOUT	 500	/* 0.5 second */
+#define DFLT_BUTTON2TIMEOUT	 200	/* 0.2 second */
 
 #define TRUE		1
 #define FALSE		0
@@ -431,27 +431,28 @@
     int s[A_TIMEOUT + 1];
     int buttons;
     int mask;
+    int timeout;
 } states[10] = {
     /* S0 */
-    { { S0, S2, S1, S3, S0 }, 0, ~(MOUSE_BUTTON1DOWN | MOUSE_BUTTON3DOWN) },
+    { { S0, S2, S1, S3, S0 }, 0, ~(MOUSE_BUTTON1DOWN | MOUSE_BUTTON3DOWN), FALSE },
     /* S1 */
-    { { S4, S2, S1, S3, S5 }, 0, ~MOUSE_BUTTON1DOWN },
+    { { S4, S2, S1, S3, S5 }, 0, ~MOUSE_BUTTON1DOWN, FALSE },
     /* S2 */
-    { { S8, S2, S1, S3, S6 }, 0, ~MOUSE_BUTTON3DOWN },
+    { { S8, S2, S1, S3, S6 }, 0, ~MOUSE_BUTTON3DOWN, FALSE },
     /* S3 */
-    { { S0, S9, S9, S3, S3 }, MOUSE_BUTTON2DOWN, ~0 },
+    { { S0, S9, S9, S3, S3 }, MOUSE_BUTTON2DOWN, ~0, FALSE },
     /* S4 */
-    { { S0, S2, S1, S3, S0 }, MOUSE_BUTTON1DOWN, ~0 },
+    { { S0, S2, S1, S3, S0 }, MOUSE_BUTTON1DOWN, ~0, TRUE },
     /* S5 */
-    { { S0, S2, S5, S7, S5 }, MOUSE_BUTTON1DOWN, ~0 },
+    { { S0, S2, S5, S7, S5 }, MOUSE_BUTTON1DOWN, ~0, FALSE },
     /* S6 */
-    { { S0, S6, S1, S7, S6 }, MOUSE_BUTTON3DOWN, ~0 },
+    { { S0, S6, S1, S7, S6 }, MOUSE_BUTTON3DOWN, ~0, FALSE },
     /* S7 */
-    { { S0, S6, S5, S7, S7 }, MOUSE_BUTTON1DOWN | MOUSE_BUTTON3DOWN, ~0 },
+    { { S0, S6, S5, S7, S7 }, MOUSE_BUTTON1DOWN | MOUSE_BUTTON3DOWN, ~0, FALSE },
     /* S8 */
-    { { S0, S2, S1, S3, S0 }, MOUSE_BUTTON3DOWN, ~0 },
+    { { S0, S2, S1, S3, S0 }, MOUSE_BUTTON3DOWN, ~0, TRUE },
     /* S9 */
-    { { S0, S9, S9, S3, S9 }, 0, ~(MOUSE_BUTTON1DOWN | MOUSE_BUTTON3DOWN) },
+    { { S0, S9, S9, S3, S9 }, 0, ~(MOUSE_BUTTON1DOWN | MOUSE_BUTTON3DOWN), FALSE },
 };
 static int		mouse_button_state;
 static struct timeval	mouse_button_state_tv;
@@ -618,8 +619,6 @@
 		}
 		rodent.zmap[0] = i;
 		rodent.zmap[1] = i + 1;
-		mstate[i - 1] = &zstate[0];
-		mstate[i] = &zstate[1];
 		debug("optind: %d, optarg: '%s'", optind, optarg);
 		for (j = 1; j < 4; ++j) {
 		    if ((optind >= argc) || !isdigit(*argv[optind]))
@@ -630,17 +629,10 @@
 			usage();
 		    }
 		    rodent.zmap[j] = i;
-		    mstate[i - 1] = &zstate[j];
 		    ++optind;
 		}
-		if ((rodent.zmap[2] != 0) && (rodent.zmap[3] == 0)) {
+		if ((rodent.zmap[2] != 0) && (rodent.zmap[3] == 0))
 		    rodent.zmap[3] = rodent.zmap[2] + 1;
-		    mstate[rodent.zmap[3] - 1] = &zstate[3];
-		}
-		for (i = 0; i < 4; ++i) {
-		    if (rodent.zmap[i] != 0)
-			rodent.zmap[i] = 1 << (rodent.zmap[i] - 1);
-		}
 	    }
 	    break;
 
@@ -711,6 +703,17 @@
 	    usage();
 	}
 
+    /* fix Z axis mapping */
+    for (i = 0; i < 4; ++i) {
+	if (rodent.zmap[i] > 0) {
+	    for (j = 0; j < MOUSE_MAXBUTTON; ++j) {
+		if (mstate[j] == &bstate[rodent.zmap[i] - 1])
+		    mstate[j] = &zstate[i];
+	    }
+	    rodent.zmap[i] = 1 << (rodent.zmap[i] - 1);
+	}
+    }
+
     /* the default port name */
     switch(rodent.rtype) {
 
@@ -2167,6 +2170,8 @@
     struct timeval tv1;
     struct timeval tv2;
 
+    if (states[mouse_button_state].timeout)
+	return TRUE;
     gettimeofday(&tv1, NULL);
     tv2.tv_sec = rodent.button2timeout/1000;
     tv2.tv_usec = (rodent.button2timeout%1000)*1000;


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200004170550.OAA26290>