9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: John Carmack johnc@idcanon1.idsoftware.com
Subject: nextstation mouse
Date: Sun,  5 Nov 1995 01:30:10 -0500	[thread overview]
Message-ID: <19951105063010.N_v5WdjF3Wp3of61fUnt3Cs8JwvxYAIY08TgL9HVKUM@z> (raw)

Here is a modification to get an adjustable, accelerative cursor =
from the standard two button NeXT mouse.

After adding this, you can modify the mouse rate by typing:

echo 'speed 3' > /dev/mousectl

John Carmack
Id Software



in 9/next/screen.c:

Add the variable:

/* JDC: for mouse acceleration */
int	mouse_speed =3D 2;

In the kbdmouseintr() function, replace the mousetrack call with:

/*				mousetrack(b, 3*-dx, 3*-dy);
JDC*/
{
int	speed;

speed =3D abs(dx) > abs(dy) ? abs(dx) : abs(dy);
speed =3D speed*speed*mouse_speed;
mousetrack(b, speed*-dx, speed*-dy);
}

change mousectl to accept a "speed" parameter.

void
mousectl(char *arg)
{
	int n;
	char *field[3];

	n =3D getfields(arg, field, 3, " ");
	if(strncmp(field[0], "serial", 6) =3D=3D 0){
		switch(n){
		case 1:
			serialmouse(atoi(field[0]+6), 0, 1);
			break;
		case 2:
			serialmouse(atoi(field[1]), 0, 0);
			break;
		case 3:
		default:
			serialmouse(atoi(field[1]), field[2], 0);
			break;
		}
	}
/* JDC */
	else if (!strcmp(field[0], "speed") && n =3D=3D 2)
	{
		mouse_speed =3D atoi(field[1]);
		if (mouse_speed < 1)
			mouse_speed =3D 1;
 	}
=09
	else
		error(Ebadctl);
}






             reply	other threads:[~1995-11-05  6:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-11-05  6:30 John [this message]
1995-11-06 22:21 Borja
1995-11-06 22:42 John

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19951105063010.N_v5WdjF3Wp3of61fUnt3Cs8JwvxYAIY08TgL9HVKUM@z \
    --to=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).