LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Wheel Mouse in 10.2 (https://www.linuxquestions.org/questions/slackware-14/wheel-mouse-in-10-2-a-370001/)

ToothlessRebel 10-05-2005 09:49 AM

Wheel Mouse in 10.2
 
I upgraded to Slack 10.2, and in the process lost the function of my scroll wheel on my mouse!

/etc/X11/XF86Config still has the ZAxisMapping "4 5" line uncommented. Thi is what allowed it to work before. Has the config script name or location changed or something? Is there some new setting in KDE 3.4?

Thanks,
-TR

detpenguin 10-05-2005 10:11 AM

this is mine in 10.2 and it works great...is your protocol IMPS/2?

Code:

Section "InputDevice"

# Identifier and driver

    Identifier        "Mouse1"
    Driver        "mouse"
    Option "Buttons" "5"
    Option "ZAxisMapping" "4 5"
    Option "Protocol"    "IMPS/2"
    Option "Device"      "/dev/mouse"


Erik_FL 10-05-2005 11:52 AM

What I found is the "ZAxisMapping" must refer to the last two button codes on the mouse whether they happen to be the wheel, or they happen to be buttons.
In my case I have a Microsoft Intellimouse Optical, that has button codes like this.

1 - Left Button
2 - Right Button
3 - Middle Button (press down on wheel)
4 - Wheel Up
5 - Wheel Down
6 - Left Side (thumb)
7 - Right Side

In order for my wheel and all buttons to work I had to do this.

In "/etc/X11/xorg.conf"
Code:

Section "InputDevice"

# Identifier and driver

    Identifier        "Mouse1"
    Driver        "mouse"
    Option "Protocol"    "ExplorerPS/2"
    Option "Device"      "/dev/mouse"
    Option "Buttons" "7"
    Option "ZAxisMapping" "6 7"

#    Option "Emulate3Buttons"
#    Option "Emulate3Timeout"    "50"

As you can see I had to lie to X-Windows and tell it that my wheel was on buttons 6 and 7 (the last two buttons).

To sort things out I had to use the "xmodmap" command to specify the correct button numbers.

In "/etc/xprofile" (which I had to create)

Code:

# X-Windows settings for all types of logins

# Map buttons for Intellimouse
xmodmap -e "pointer = 1 2 3 6 7 4 5"

Each position in the "pointer =" option is a physical mouse button input.
Each number indicates the internal button code that X-Windows should actually use when that physical button is pressed.

The end result is this:

Real Mouse Button ---> X-Windows Button Code
1 --> 1 (left)
2 --> 2 (right)
3 --> 3 (middle)
4 --> 6 (wheel up)
5 --> 7 (wheel down)
6 --> 4 (left side)
7 --> 5 (right side)

From the perspective of X-Windows my mouse looks like this.

1 (left)
2 (right)
3 (middle)
4 (left side)
5 (right side)
6 (wheel up)
7 (wheel down)

If you want your own custom settings for a user login, you can create your own ".xprofile" in your home directory.
Code:

# Map buttons for Intellimouse
xmodmap -e "pointer = 1 2 3 6 7 4 5"
# Mouse button macros
imwheel -k -b "4567"

Above is my ".xprofile" that adds the "imwheel" program to support button macros.

To save yourself a lot of grief, do not try to use ".xinitrc" or ".Xmodmap " or the global versions of those files to specify the mouse button mapping. Those files do not get executed when you use the graphical login window for KDE, and I wasted a lot of time trying to figure out why the mouse wouldn't work right. It turns out that only "/etc/xprofile" or ".xprofile" is executed for ALL types of logins.

If your mouse actually has the wheel using the last two button codes, then you should be able to just use the correct button codes for "ZAxisMapping". For example, if you have a wheel mouse with only Left, Right, and Middle (wheel) buttons, plus the wheel using the last two button codes, you can do this.

In "/etc/X11/xorg.conf"
Code:

Section "InputDevice"

# Identifier and driver

    Identifier        "Mouse1"
    Driver        "mouse"
    Option "Protocol"    "ExplorerPS/2"
    Option "Device"      "/dev/mouse"
    Option "Buttons" "5"
    Option "ZAxisMapping" "4 5"

#    Option "Emulate3Buttons"
#    Option "Emulate3Timeout"    "50"

You don't need to use "xmodmap", since the button codes match those expected by X-Windows.

If you are going to use the "imwheel" program and also have to remap your mouse buttons there are some special considerations. The "imwheel" program wants buttons arranged like this.

1 (left)
2 (right)
3 (middle)
4 Up / Button4 (wheel up)
5 Down / Button5 (wheel down)
6 Left / Button6 (wheel left)
7 Right / Button7 (wheel right)
8 Thumb1 / Button8 (extra button)
9 Thumb2 / Button9 (extra button)

One of the weirder things about "imwheel" is it refers to the buttons coming in with one set of names "Up, Down, etc." and the buttons going out with a different set of names "Button4, Button5, etc.".

As you can see this doesn't match either my mouse, nor X-Windows.
I decided to just think of my left/right side buttons as "wheel left" and "wheel right", since "imwheel" uses the names "left" and "right" to refer to them. However, that meant I could not use the default configuration files provided with "imwheel".

To give "imwheel" the desired mouse button inputs I had to do this.

Part of my ".xprofile" file.
Code:

# Mouse button macros
imwheel -k -b "4567"

There may be other options that work with "imwheel" but I didn't try any more experimenting. If your buttons are arranged in a different order, then you will need to change "4567" to something else.

I had to create my own "default" configuration for "imwheel" to start off with, and then add to the file as needed.

Here is the default ".imwheelrc" file that I put in my home directory.

Code:

# IMWheel Configuration file ($HOME/.imwheelrc or /etc/imwheelrc)
# (GPL)Jon Atkins <jcatki@jonatkins.org>
# Please read the README and/or imwheel(1) manpage for info
# and this is best operated on using vim (as I said: It's crunchy)

#"^Mozilla-bin$"
#,        Up,        Button4
#,        Down,        Button5
#,        Left,        Alt_L|Left
#,        Right,        Alt_L|Right

# Pass through mouse events for everything else
".*"
@Exclude

If I uncomment the definition for "Mozilla" it just maps the wheel buttons in (Up and Down) to the wheel buttons out (Button4 and Button5). That does the equivalent of the "@Exclude" for those button codes. It maps the left side and right side buttons in (Left and Right) to some keycodes (alternate+left arrow) and (alternate+right arrow). Those are the codes for previous page, and next page in the Mozilla browser. Mozilla already understands the mouse button codes, so this is unecessary.

If you wanted to define the equivalent of "@Exclude" just for one application you would do this.

Code:

"^appname$"
,        Up,        Button4
,        Down,        Button5
,        Left,        Button6
,        Right,        Button7

That works, but is unecessary, since not mentioning the application at all uses the "@Exclude" definition that does the same thing. It does give you a better idea of how "imwheel" refers to the buttons coming in from the mouse, and going out to X-Windows.

If you have no left and right buttons, and you want your wheel to change to a left/right wheel when you press either Alt key, you can use this definition.

Code:

"^appname$"

# Alt buttons with wheel scroll left and right
Alt_L,        Up,        Button6
Alt_L,        Down,        Button7
Alt_R,        Up,        Button6
Alt_R,        Down,        Button7
Alt_R|Alt_L,        Up,        Button6
Alt_R|Alt_L,        Down,        Button7
# Any other key combinations, wheel scrolls up and down
,        Up,        Button4
,        Down,        Button5

Unless you expect someone left-handed to use the mouse, you can leave out the "Alt_R" definitions. It's kind of awkward to press the right-hand Alt button and move the mouse wheel. The same goes for "Alt_R|Alt_L", since pressing both Alt buttons and using the mouse is unlikely. The first argument on each line can also be "None" which is not the same thing as leaving it out entirely. Using "None" means no keys pressed. Leaving it out means any key combinations pressed (except for one's already mentioned).

ToothlessRebel 10-05-2005 02:02 PM

Hmm... yes my protocol is IMPS/2.

Erik, is your information for all applications/installations of X or Slackware 10.2 specificly? I was previously using IMPS/2 and the ZAxisMapping option with buttons 4 and 5 and it worked fine.

I'll double check the format of the option when I get home. Also, Erik is using /etc/X11/xorg.conf for his input device definitions. This file I believe exists on my computer but is not what I refered to, which was /etc/X11/XF86Config.

Thanks
~TR

gbonvehi 10-05-2005 02:15 PM

Well since Slackware 10.2 uses Xorg instead of Xfree, the configuration file for Xorg is read from /etc/X11/xorg.conf (XF86Config was used by XFree86), so you should enable ZAxisMapping there.

Erik_FL 10-05-2005 02:28 PM

The information I posted pertains specifically to Slackware version 10.2, and using a mouse where the wheel codes are not the last two button codes for the mouse.

In order to get my mouse wheel to operate in Slackware version 10.2, I had to edit "/etc/xorg.conf", and not the file you mentioned. Unless that file is symbolically linked to "/etc/xorg.conf" that could be why your mouse wheel doesn't work.

If I remember correctly, there were a number of files with names simlar to "xorg.conf" that appeared to be examples, or initial configurations. Those files did not appear to be used after Linux was installed.

From what I understand, different versions and distributions of Linux handle "ZAxisMapping" in different ways. Some versions of Linux ignore any button numbers higher than the one's listed in "ZAxisMapping", or don't see the buttons listed in "ZAxisMapping" if they aren't the last two buttons.

If you have a mouse wheel that sends button codes 4 and 5, you should be able to make it work by setting the number of buttons to 5, and then putting buttons 4 and 5 in the "ZAxisMapping" option. That's what detpenguin stated.

If you happen to have buttons 6 and 7 on your mouse (as I do) then you won't be able to use those buttons with that configuration, although the wheel will work. Even setting the number of buttons to 7 will not allow buttons 6 and 7 to work (and might make the wheel stop working).


All times are GMT -5. The time now is 07:05 AM.