[NEWBIE] mouse button help

Ned Konz ned at bike-nomad.com
Fri Jan 3 06:20:58 UTC 2003


On Thursday 02 January 2003 07:30 pm, Doug Clapp wrote:
> I have a "can't get there from here" problem and hope you can help.
>
> I have a two-button Logitech "Wheel" mouse  A click on the wheel
> now gives a "Blue" (bring up halos) click -- just as I want it. 
> The left button now sends red and the right button yellow.
>
> I'd merely like to reverse the left and right button actions, to
> conform to how the mouse works everywhere else on my system. 

So you want the right button to be red (select) and the left button to 
be yellow (context menu), correct? (while leaving the middle/wheel 
button as blue/halo).

> "swapping buttons" in Preferences doesn't work -- and torches the
> wheel button click action in the process.  Nor does the "3-button"
> choice in the VM Preferences do the trick.

You don't say what OS you're using, but it sounds like the Windows VM.

> I've look at EventSensor and InputSensor but...I'm stumped.  If I
> was less of a newbie, I'd make a ClickAndKeyboardConfigurator morph

There is a lookup table (InputSensor class var ButtonDecodeTable) that 
I put in for the swap buttons preference. You can change its contents 
if you wish to swap the red and yellow buttons.

Look at InputSensor class>>installMouseDecodeTable for how I swapped 
the lowest-order two bits, and just make it swap bits 1 and 2 (masks 
2 and 4) instead.

The mouse bit masks are:
		2	-	yellow button
		1	-	blue button
		4	-	red button

So this would work (if you also turn on the swapMouseButton 
preference), I think:

InputSensor class>>swapYellowAndRedButtons
	"InputSensor swapYellowAndRedButtons"
	ButtonDecodeTable _ ButtonDecodeTable collect: [:ea |
								((ea bitAnd: 2) << 1
									bitOr: (ea bitAnd: 4) >> 1)
										bitOr: (ea bitAnd: 16rFD)]

Or something like it should, anyway.

-- 
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE




More information about the Squeak-dev mailing list