Version 1 of Touchpad Binding for Horizontal Scrolling

Updated 2004-10-16 21:52:13

AJB - Background: Having a touchpad can be very usefull in X-windows. With the proper drivers you get a handfull of controllable mouse gestures that map to button bindings. Examples: Punch down with a single finger on the pad for a Button-1 event, Two fingers at the same time for a Button-2 event, Three fingers for Button-3 (Only 3 of my fat fingers fit on the pad, but it should be possible to do more). Also, and most usefull, sliding your finger up and down on the left vertical edge of the pad generates Button-4 and Button-5 events, depending on direction, and these map out just fine. The problem comes with the bottom edge of the pad that is mapped to Button-6 and Button-7 events. However, X.h does not, and can not, define a Button6MotionMask or Button7MotionMask. Which the Current Tk code relys on :( So, With a bit of help from RS on the chat here is a solution to the problem.

 bind . <Button> {if {"%b" eq 6} {puts left} elseif {"%b" eq 7} {puts right}}

This works because the %b will report the numbers back correctly, even though <Button-6> or <Button-7> event bindings are invalid.

I hope that there is a better solution coming one day. I understand that the x people were able to define <Btn6Up> and <Btn6Down> events, maybe that could be used to incorporate these into the core? I really dont no enough about it to tell, but I did no enough to get this far. Frustrating.

Thanks to RS for added guidance at the end.