Subject: Mouse button autorepeat
To: None <tech-kern@netbsd.org>
From: Julio M. Merino Vidal <jmmv84@gmail.com>
List: tech-kern
Date: 02/02/2006 18:06:43
Hi all,

I recently got a trackball that has four buttons.  It has no wheel but
two of the buttons are designed to simulate it (button 3 does a wheel
down and button 4 does a wheel up).

The mouse comes with special drivers for Windows and Mac OS that handle
the scrolling.  If you leave either button 3 or 4 pressed, it  
automatically
repeats the scrolling events, so what you have on screen effectively
scrolls multiple times.  I find this very, very comfortable and useful
(otherwise the buttons are mostly useless).

Unfortunately, neither wsmouse nor X11 can simulate this feature.  Yet.

I've patched wsmouse(4) to be able to simulate autorepeating for
some buttons, similarly to what wskbd(4) has.  You can see the
preliminary patch in:

	ftp://ftp.NetBSD.org/pub/NetBSD/misc/jmmv/repeat.diff

which I'd like to commit in the following days.

Some things to discuss:

- Should this functionality be optional?  (I hear 'of course'...
   but it's not that big and machines that use mice shouldn't be
   too tight on memory, or do they?)

- The interface I added to wsconsctl(8) looks like the following:

   $ wsconsctl -m -a
   repeat.del1="0 0 0 200 200 0 0 0 ..."
   repeat.delN="0 0 0 100 100 0 0 0 ..."

   It tries to mimic the one for wskbd, but as there are multiple
   buttons, they should be configurable independently (you surely
   do not want button 0 to autorepeat).

   Each integer in the variable represents a button.  Similarly,
   the same interface is used to set the delays:

   $ wsconsctl -m -w repeat.del1="0 0 100"

   This sets the delay for first repeat on button 2, disabling the
   delay for button 0 and 1.

   The kernel stores this in appropriate structures, not strings.

   Any better idea?

   Note that at the moment this looks bad because the kernel always
   returns 32 buttons for the mouse.  (This is the 'TODO' I left in
   wsmouse_attach).  Should be better when the kernel returns the
   appropriate numbers (i.e., the integer list will be much shorter).

- I'll work on fixing the  'TODO' and 'XXX' markers added to
   wsmouse_attach after commiting this.  These should be easy to
   do but are completely unrelated to the patch so I haven't done
   them yet.

Please comment.

Thanks,

-- 
Julio M. Merino Vidal <jmmv84@gmail.com>
The Julipedia - http://julipedia.blogspot.com/