[ltp] tp-scroll with bells and whistles

Marius Gedminas linux-thinkpad@linux-thinkpad.org
Thu, 5 Feb 2004 01:30:44 +0200


--lc9FT7cWel8HagAv
Content-Type: multipart/mixed; boundary="m51xatjYGsM+13rf"
Content-Disposition: inline


--m51xatjYGsM+13rf
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

I have a T23 with a 3-button trackpoint (no touchpad).  Today I
downloaded tp-scroll (http://rsim.cs.uiuc.edu/~sachs/tp-scroll/) and
started playing with it.  End result:

  Middle button click can be used for pasting (I missed that when I used
  the EmulateWheel option of XFree86).

  Holding down the middle button and dragging gives me two emulated
  mouse wheels (horizontal and vertical).  The horizontal "wheel" works in
  Mozilla and GIMP.  I haven't tried other apps yet, but I think support
  for a horizontal wheel is built into all Gtk2 apps.

  Left + right buttons together emulate the middle button -- this is the
  only way to achieve dragging with the middle button (needed for e.g.
  gdesklets).

  If I switch to a virtual console, I can use gpm there -- tp-scroll
  happily coexists with it.

Here's how you can achieve that:

  1. Download and untar tp-scroll 1.0 from
     http://rsim.cs.uiuc.edu/~sachs/tp-scroll/tp-scroll-1.0.tgz

  2. Apply the attached patch that fixes bugs in horizontal scrolling
     code (cd tp-scroll-1.0; patch -p1 < tp-scroll.patch).

I sent it to the upstream author, hopefully it will be integrated soon.

  3. Build it (just type make) and install tp-scroll into /usr/local/bin or
     wherever.

  4. mkfifo /dev/imouse

  5. Add the following line to /etc/rc.d/rc.local or whatever your
     distribution uses for local startup scripts

       /usr/local/bin/tp-scroll -i /dev/psaux -o /dev/imouse &

     If you want to use gpm together with tp-scroll, use this line
     instead

       /usr/local/bin/tp-scroll -i /dev/gpmdata -o /dev/imouse &

     and make sure the gpm repeater is enabled with protocol
     'raw' (-Rraw)

  6. Edit your XF86Config-4 and replace your mouse configuration section
     with the following:

        Section "InputDevice"
                Identifier      "Trackpoint with tp-scroll"
                Driver          "mouse"
                Option          "CorePointer"
                Option          "Device"                "/dev/imouse"
                Option          "Protocol"              "ExplorerPS/2"
                Option          "Buttons"               "7"
                Option          "ZAxisMapping"          "6 7"
                Option          "Emulate3Buttons"       "true"
                Option          "EmulateWheel"          "false"
        EndSection

     (and make sure the ServerLayout section refers to this device)

  7. Start X and run the following in an xterm:

        xmodmap -e "pointer =3D 1 2 3 6 7 4 5"

     otherwise the horizontal and vertical axes will be swapped when
     scrolling.  It is a good idea to place this line into your
     ~/.xsession or equivalent.

That's it.

If you use Mozilla Firebird, you'll also want to go to about:config and
change the value of mousewheel.horizscroll.withnokey.action to 0
(scroll) instead of 2 (history).  That's assuming your Firebird is built
with Gtk2, if you have a Gtk1 build you'll have to do the same with
mousebuttonsextended.buttons.{6,7}.actions.{up,down}

Enjoy,
Marius Gedminas
--=20
The IQ of the group is the lowest IQ of a member of
the group divided by the number of people in the group.

--m51xatjYGsM+13rf
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="tp-scroll.patch"
Content-Transfer-Encoding: quoted-printable

--- tp-scroll-1.0/tp-scroll.c.orig	Wed Feb  4 23:29:13 2004
+++ tp-scroll-1.0/tp-scroll.c	Thu Feb  5 00:36:17 2004
@@ -230,9 +230,9 @@
 		{
 		    scroll =3D 1;
=20
-		    f =3D (double)z_accel_mult * pow( (double)(abs(y)), (double)z_accel_=
exp);
+		    f =3D (double)z_accel_mult * pow( (double)(abs(x)), (double)z_accel_=
exp);
 #ifdef DEBUG
-		    printf("x scroll %i %f accum %f\n",y,f,x_scroll_accum);
+		    printf("x scroll %i %f accum %f\n",x,f,x_scroll_accum);
 #endif
 		=09
 		    for( x_scroll_accum +=3D f; x_scroll_accum > 1.0; x_scroll_accum -=
=3D 1.0 )
@@ -240,7 +240,11 @@
 			putc(b & 0x0B, out);
 			putc(0, out);
 			putc(0, out);
-		        y < 0 ? putc(0x10, out) : putc(0x20, out);
+		        x < 0 ? putc(0x10, out) : putc(0x20, out);
+			putc(b & 0x0B, out);
+			putc(0, out);
+			putc(0, out);
+			putc(0, out);
 		    }
=20
 		    fflush(out);

--m51xatjYGsM+13rf--

--lc9FT7cWel8HagAv
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAIYCkkVdEXeem148RAssgAJ0fv3PGp98OoAAO4n4CNHgHOlmnQgCfdq1O
KPDWYbs2kbRoPQMc1LtRV4g=
=DZEp
-----END PGP SIGNATURE-----

--lc9FT7cWel8HagAv--