This does two things (well, three, but I'd delete the third one).
First, it adds "scrollswap" as a ctl for mousectl. The reason is that
some mouses we found send the wrong buttons (5/4) instead of the
usual ones (4/5) for the wheel.
Second (the reason for this patch) it changes buf in mouseread to
hold one extra space after the 4th number and puts an space after
the 4th number in the read buffer. We noticed (the hard way) that
/dev/mouse was not supplying 49 bytes as the man page said. This has
nasty effects when sending mouse events through tcp (that does not
have message delimiters). I'd either fix this, or change the man page.
In any case, I think /dev/mouse is supplying the extra \0 of the string
instead of the extra " ", which is weird.
The third thing (that I'd probably not apply), is to support "M ..."
messages instead of "m ...", to let the user send absolute mouse positions
to the mouse. We use this for the usb touch screen, but we're going to
convert it to use #m/mousein instead. Hope it's not hard for you to
just extract the useful part of this patch.
|