Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Vertical Scroll & Middle button 4-button trackball(xorg<7)
View unanswered posts
View posts from last 24 hours

Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message

Joined: 23 Apr 2004
Posts: 1063

PostPosted: Tue Dec 20, 2005 5:20 pm    Post subject: Vertical Scroll & Middle button 4-button trackball(xorg& Reply with quote

Edit: (April 2006)Currently not working properly in xorg-x11-7.0, will work on it and modify this post.

The following example uses a Logitech Marble Mouse, it consists of 4 buttons and a trackball. The mouse is ambidextrous, with a large and small button on either side of the trackball. The explanation should give good ideas on how to configure other mice types.
Important tools for configuring other mice are xev, to determine what physical buttons activate which events, and xmodmap to change that.

Here is the relevant portion of xorg.conf. Don't just paste it into your xorg.conf without reading the rest.

Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "CorePointer"
Option "Buttons" "7"
Option "Name" "Logitech USB Trackball"
Option "Protocol" "auto"
Option "Device" "/dev/input/mice"
Option "YAxisMapping" "6 7"
Option "EmulateWheel" "True"
Option "EmulateWheelButton" "4"

Test your device (If you already have your mouse working in X, this is unnecessary)
From tests almost any reasonable protocol will work, ie "auto" or "ImPS/2" or "ExplorerPS/2". "Device" must be pointed correctly. To test what is correct on your system:
cat /dev/input/mice
and move the mouse around.

  • If you see odd characters on your screen it is correct.
  • If you see nothing then either

    1. Needed options in the kernel are not there.
    2. Check some other device, ie /dev/mouse, /dev/input/mouse.
    3. You have hardware issues.

The first item on the agenda once our device is working is increasing the amount of buttons that Xorg knows about.
Now the explanation. Although my mouse has only 4 physical buttons, you see

Option "Buttons" "7"
Option "YAxisMapping" "6 7"
Option "EmulateWheel" "True"
Option "EmulateWheelButton" "4"

Without this, my 4 physical buttons map to two (button 1 and 3) and emulated middle (button 2).
The 7 available buttons are now these:

  • Large left button
  • Emulated middle click
  • Large right button
  • small left button
  • small right button
  • scroll up
  • scroll down

You may notice that instead of the normal
"ZAxisMapping" "6 7"
there is
"YAxisMapping" "6 7"
With ZAxisMapping the scroll buttons map to button 4 & 5. You would now have scrolling in X, but the physical 5th button is duplicated and will only scroll up.
With YAxisMapping you have all 7 buttons, with buttons 6 & 7 accessed by holding 4 and using the trackball.
The problem here is that scroll up & down are still mapped to buttons 4 & 5, so that you don't actually have any scroll yet.

We need to remap buttons 4 & 5 to buttons 6 & 7
xmodmap -e "pointer = 1 2 3 6 7 4 5"
We have now mapped physical buttons '4 5 6 7' to '6 7 4 5'. That gives us the ability to scroll by holding the small left button
Option "EmulateWheelButton" "4"
and moving the trackball. If you wish you could make any button the one to hold, ie
Option "EmulateWheelButton" "5"
would make the small right button the scroll button in this configuration.

At this point everything works

  1. Left Click
  2. Emulated Middle
  3. Right Click
  4. EmulateWheel
  5. Nothing
  6. Using (4&Trackball) UP
  7. Using (4&Trackball)DOWN

Still I would like that small right button to do something useful.
xmodmap -e "pointer = 1 7 3 6 2 4 5"

  • Button 2 (Emulated Middle Click) is mapped to 7 (Nothing)
  • Button 5 (Nothing) is now Middle Click

There is an interesting effect that gives both horizontal and vertical scroll in some programs. Clicking button 5, the middle click button allows multi-scroll. Not sure why.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum