NetBSD Problem Report #58672

From www@netbsd.org  Sat Sep 14 23:22:30 2024
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits)
	 client-signature RSA-PSS (2048 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 963B71A9244
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 14 Sep 2024 23:22:30 +0000 (UTC)
Message-Id: <20240914232229.48DEF1A9246@mollari.NetBSD.org>
Date: Sat, 14 Sep 2024 23:22:29 +0000 (UTC)
From: nathanialsloss@yahoo.com.au
Reply-To: nathanialsloss@yahoo.com.au
To: gnats-bugs@NetBSD.org
Subject: Change request [PATCH] Emulated buttons only sent on mouse click
X-Send-Pr-Version: www-1.0

>Number:         58672
>Category:       port-mac68k
>Synopsis:       Change request [PATCH] Emulated buttons only sent on mouse click
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    nat
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Sep 14 23:25:00 +0000 2024
>Closed-Date:    Mon Jan 20 16:31:43 +0000 2025
>Last-Modified:  Mon Jan 20 16:31:43 +0000 2025
>Originator:     Nat Sloss
>Release:        NetBSD-10.0 apples to -9 and -current
>Organization:
PowerBook Salvage and Rescue
>Environment:
NetBSD 10.99.12 (WSFBPWR) #258: Sat Sep 14 10:32:34 AEST 2024
build@microrusty:/home/build/nbsd10/sys/arch/mac68k/compile/WSFBPWR
>Description:
Emulated mouse buttons on mac68k (buttons 2 and 3) are only sent when
a mouse event is generated.

Clicking the button or moving the mouse sends the emulated event.

It would be preferred that the event was sent when clicking the mouse
button only.

There is one draw back to this that it is not possible with the attached
patch to send mouse button chords unless "options ALTXBUTTONS" is
enabled also.

But it does make it easier to send the emulated buttons.
>How-To-Repeat:
Use emulated mouse buttons on mac68k with a one button mouse.
>Fix:
Apply the attached patch (to be sent in a follow up email).

>Release-Note:

>Audit-Trail:
From: Nat Sloss <nathanialsloss@yahoo.com.au>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: port-mac68k/58672: Change request [PATCH] Emulated buttons only sent on mouse click
Date: Sun, 15 Sep 2024 09:34:39 +1000

 --Boundary-00=_P2h5mqU6M4b8EzS
 Content-Type: Text/Plain;
   charset="iso-8859-15"
 Content-Transfer-Encoding: 7bit

 Here is the attached patch:


 --Boundary-00=_P2h5mqU6M4b8EzS
 Content-Type: text/x-patch;
   charset="ISO-8859-1";
   name="toapply.7.diff"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
 	filename="toapply.7.diff"

 --- a/sys/arch/mac68k/dev/ams.c	Thu Sep 12 21:47:15 2024 +0000
 +++ b/sys/arch/mac68k/dev/ams.c	Sun Sep 15 05:56:15 2024 +1000
 @@ -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
 --- a/sys/arch/mac68k/dev/amsvar.h	Thu Sep 12 21:47:15 2024 +0000
 +++ b/sys/arch/mac68k/dev/amsvar.h	Sun Sep 15 05:56:15 2024 +1000
 @@ -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 */


 --Boundary-00=_P2h5mqU6M4b8EzS--

Responsible-Changed-From-To: port-mac68k-maintainer->nat
Responsible-Changed-By: nat@NetBSD.org
Responsible-Changed-When: Sat, 07 Dec 2024 10:18:32 +0000
Responsible-Changed-Why:
Mine.


From: "Nathanial Sloss" <nat@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58672 CVS commit: src/sys/arch/mac68k/dev
Date: Sat, 7 Dec 2024 10:23:54 +0000

 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.

State-Changed-From-To: open->closed
State-Changed-By: nat@NetBSD.org
State-Changed-When: Mon, 20 Jan 2025 16:31:43 +0000
State-Changed-Why:
Fixed.  Patch from PR applied.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.