Subject: bin/19143: Left handed support for wsmoused
To: None <gnats-bugs@gnats.netbsd.org>
From: Julio Merino <jmmv@menta.net>
List: netbsd-bugs
Date: 11/23/2002 12:00:44
>Number:         19143
>Category:       bin
>Synopsis:       Left handed support for wsmoused
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Nov 23 02:56:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Julio Merino
>Release:        NetBSD 1.6K
>Organization:
HispaBSD
>Environment:
	
	
System: NetBSD darkstar.local 1.6K NetBSD 1.6K (DARKSTAR) #133: Sun Nov 17 21:31:10 CET 2002 sysbuild@darkstar.local:/var/sysbuild/kernel/DARKSTAR i386
Architecture: i386
Machine: i386
>Description:
	wsmoused has no support for switching mouse buttons. This is
	specially disturbing for people who uses his mouse with his left
	hand. wsmoused should have an option to switch mouse button
	behavior, so left handed users can easily use it.
>How-To-Repeat:
	Start wsmoused, use your mouse with your left hand ;)
>Fix:
	This patch adds a new '-l' flag which effectively switches button
	behavior.

Index: events.c
===================================================================
RCS file: /cvsroot/basesrc/usr.sbin/wsmoused/events.c,v
retrieving revision 1.3
diff -u -u -r1.3 events.c
--- events.c	2002/07/04 20:50:29	1.3
+++ events.c	2002/11/23 10:50:40
@@ -101,27 +101,27 @@
 {
 	switch (evt->type) {
 	case WSCONS_EVENT_MOUSE_UP:
-		if (evt->value == 0) {
+		if (evt->value == m->but_select) {
+			/* End selection */
 			mouse_sel_end(m);
 			mouse_sel_hide(m);
 		}
 		break;
 
 	case WSCONS_EVENT_MOUSE_DOWN:
-		switch (evt->value) {
-		case 0: /* Button 1 */
+		if (evt->value == m->but_select) {
+			/* Start selection */
 			mouse_sel_start(m);
 			mouse_cursor_hide(m);
 			mouse_sel_show(m);
-			break;
-		case 2: /* Button 2 */
+		} else if (evt->value == m->but_paste) {
+			/* Paste selection */
 			mouse_sel_paste(m);
 			break;
 		}
-		break;
 
 	default:
-		warnx("unknown event");
+		warnx("unknown button event");
 	}
 }
 
Index: wsmoused.8
===================================================================
RCS file: /cvsroot/basesrc/usr.sbin/wsmoused/wsmoused.8,v
retrieving revision 1.6
diff -u -u -r1.6 wsmoused.8
--- wsmoused.8	2002/10/25 21:02:45	1.6
+++ wsmoused.8	2002/11/23 10:50:41
@@ -56,6 +56,8 @@
 .It Fl f Ar fifo
 is used to specify an optional fifo where to redirect all mouse events
 (even if they have been processed). By default, no fifo is used.
+.It Fl l
+swaps mouse buttons, specially useful for left handed users.
 .It Fl n
 do not fork in the background (for debugging purposes).
 .It Fl X Ar number
Index: wsmoused.c
===================================================================
RCS file: /cvsroot/basesrc/usr.sbin/wsmoused/wsmoused.c,v
retrieving revision 1.5
diff -u -u -r1.5 wsmoused.c
--- wsmoused.c	2002/08/20 16:55:28	1.5
+++ wsmoused.c	2002/11/23 10:50:41
@@ -314,14 +314,22 @@
 	mouse.slowdown_x = 0;
 	mouse.slowdown_y = 3;
 
+	/* Right handed by default */
+	mouse.but_select = 0;
+	mouse.but_paste = 2;
+
 	/* Parse command line options */
-	while ((opt = getopt(argc, argv, "nf:d:X:x:y:")) != -1) {
+	while ((opt = getopt(argc, argv, "nlf:d:X:x:y:")) != -1) {
 		switch (opt) {
 		case 'd': /* Mouse device name */
 			mouse.device_name = strdup(optarg);
 			break;
 		case 'f': /* FIFO file name */
 			mouse.fifo_name = strdup(optarg);
+			break;
+		case 'l': /* Left handed */
+			mouse.but_select = 2;
+			mouse.but_paste = 0;
 			break;
 		case 'n': /* No daemon */
 			NoDaemon = 1;
Index: wsmoused.h
===================================================================
RCS file: /cvsroot/basesrc/usr.sbin/wsmoused/wsmoused.h,v
retrieving revision 1.1
diff -u -u -r1.1 wsmoused.h
--- wsmoused.h	2002/06/26 23:13:11	1.1
+++ wsmoused.h	2002/11/23 10:50:41
@@ -52,6 +52,10 @@
 	int cursor;
 	int selecting;
 	int disabled;
+
+	/* Button configuration */
+	int but_select;
+	int but_paste;
 };
 
 /* Prototypes for wsmoused.c */



	Thanks ;)
>Release-Note:
>Audit-Trail:
>Unformatted: