Module Name:    src
Committed By:   nat
Date:           Sat Dec  7 10:23:54 UTC 2024

Modified Files:
        src/sys/arch/mac68k/dev: ams.c amsvar.h

Log Message:
Usability enhancement.

For the emulated middle and right mouse buttons, one has to hold the combo keys
and it is sent on the mouse click.

Patch from PR applied.

Addresses PR mac68k/58672.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/mac68k/dev/ams.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/mac68k/dev/amsvar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/mac68k/dev/ams.c
diff -u src/sys/arch/mac68k/dev/ams.c:1.26 src/sys/arch/mac68k/dev/ams.c:1.27
--- src/sys/arch/mac68k/dev/ams.c:1.26	Sat Jul 30 07:27:55 2022
+++ src/sys/arch/mac68k/dev/ams.c	Sat Dec  7 10:23:54 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ams.c,v 1.26 2022/07/30 07:27:55 rin Exp $	*/
+/*	$NetBSD: ams.c,v 1.27 2024/12/07 10:23:54 nat Exp $	*/
 
 /*
  * Copyright (C) 1998	Colin Wood
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ams.c,v 1.26 2022/07/30 07:27:55 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ams.c,v 1.27 2024/12/07 10:23:54 nat Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -499,15 +499,27 @@ ms_processevent(adb_event_t *event, stru
 	new_event.u.m.dy = ((signed int) (event->bytes[0] & 0x3f)) -
 				((event->bytes[0] & 0x40) ? 64 : 0);
 
+	int phys_buttons = new_event.u.m.buttons;
 #if NAED > 0
 	if (!aed_input(&new_event))
 #endif
 #if NWSMOUSE > 0
-		if (amsc->sc_wsmousedev != NULL) /* wsmouse is attached? */
+		if (amsc->sc_wsmousedev != NULL)  { /* wsmouse is attached? */
+			if ((phys_buttons != new_event.u.m.buttons) &&
+							    (phys_buttons & 1))
+				amsc->sc_oldbuttons =
+				    new_event.u.m.buttons & ~1;
+			else if ((phys_buttons == new_event.u.m.buttons) &&
+						    (amsc->sc_oldbuttons == 0))
+				amsc->sc_oldbuttons = phys_buttons;
+
+			if (phys_buttons == 0)
+				amsc->sc_oldbuttons = 0;
 			wsmouse_input(amsc->sc_wsmousedev,
-			    new_event.u.m.buttons,
+			    amsc->sc_oldbuttons,
 			    new_event.u.m.dx, -new_event.u.m.dy, 0, 0,
 			    WSMOUSE_INPUT_DELTA);
+		}
 #else
 		/* do nothing */ ;
 #endif

Index: src/sys/arch/mac68k/dev/amsvar.h
diff -u src/sys/arch/mac68k/dev/amsvar.h:1.9 src/sys/arch/mac68k/dev/amsvar.h:1.10
--- src/sys/arch/mac68k/dev/amsvar.h:1.9	Sat Oct 27 17:17:59 2012
+++ src/sys/arch/mac68k/dev/amsvar.h	Sat Dec  7 10:23:54 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: amsvar.h,v 1.9 2012/10/27 17:17:59 chs Exp $	*/
+/*	$NetBSD: amsvar.h,v 1.10 2024/12/07 10:23:54 nat Exp $	*/
 
 /*
  * Copyright (C) 1998	Colin Wood
@@ -45,6 +45,7 @@ struct ams_softc {
 	/* Extended Mouse Protocol info, faked for non-EMP mice */
 	u_int8_t	sc_class;	/* mouse class (mouse, trackball) */
 	u_int8_t	sc_buttons;	/* number of buttons */
+	u_int8_t	sc_oldbuttons;	/* button state */
 	u_int32_t	sc_res;		/* mouse resolution (dpi) */
 	char		sc_devid[5];	/* device indentifier */
 

Reply via email to