Horizontal scrolling treated as right click in Java applications

I've enabled horizontal scrolling for my touchpad in Ubuntu 11.04, but when using it in Java applications (NetBeans in my case) it is instead as a right click.

Horizontal scrolling works perfectly in all applications that are not written in Java.

What can I do to make it work properly?


That is this bug. You can fix it as described there, by running synclient HorizTwoFingerScroll=0 (two finger scroll will still work fine).

You can add the command at startup with the "startup applications" dialog.


Possible workaround was discussed on UbuntuForums - you either run manually a script to enable or disable the right-click depending upon whether you are using a JAVA based application.

You could - for example, connect each of the scripts as Keyboard Shortcuts e.g. CTRL+ALT + E to enable and CTRL+ALT + R to disable

Create a script called "hscroll_disable" containing:

DEVICE_NAME='TPPS/2 IBM TrackPoint'
PROP_NAME='Evdev Wheel Emulation Axes'

xinput set-int-prop "$DEVICE_NAME" "$PROP_NAME" 8 4 5 4 5
if [[ $? -eq 0 ]] ; then
  zenity --info --text "Horizontal Scrolling Disabled"
else
  zenity --error --text "Error disabling horizontal scroll."
fi

Create a script called "hscroll_disable" containing:

DEVICE_NAME='TPPS/2 IBM TrackPoint'
PROP_NAME='Evdev Wheel Emulation Axes'

xinput set-int-prop "$DEVICE_NAME" "$PROP_NAME" 8 6 7 4 5
if [[ $? -eq 0 ]] ; then
  zenity --info --text "Horizontal Scrolling Enabled"
else
  zenity --error --text "Error enabling horizontal scroll."
fi

Give both scripts execute permission i.e.

chmod +x hscroll_disable
chmod +x hscroll_enable

The two important parts of the scripts are "DEVICE_NAME" and "PROP_NAME"

You can find out which device name to use on your system like this:

xinput list --short

This will give an output similar to:

"Virtual core pointer"  id=0    [XPointer]
"Virtual core keyboard" id=1    [XKeyboard]
"ThinkPad Extra Buttons"        id=2    [XExtensionKeyboard]
"AT Translated Set 2 keyboard"  id=3    [XExtensionKeyboard]
"Video Bus"     id=4    [XExtensionKeyboard]
"Macintosh mouse button emulation"      id=5    [XExtensionPointer]
"TPPS/2 IBM TrackPoint" id=6    [XExtensionPointer]

Then to find the property-name:

xinput list-props "TPPS/2 IBM TrackPoint"

This will give an output similar to:

Device 'TPPS/2 IBM TrackPoint':
        Device Enabled (93):            1
        Evdev Axis Inversion (230):             0, 0
        Evdev Reopen Attempts (227):            10
        Evdev Axis Calibration (228):           
        Evdev Axes Swap (229):          0
        Evdev Middle Button Emulation (231):            1
        Evdev Middle Button Timeout (232):              50
        Evdev Wheel Emulation (233):            1
        Evdev Wheel Emulation Axes (234):               6, 7, 4, 5
        Evdev Wheel Emulation Inertia (235):            10
        Evdev Wheel Emulation Timeout (236):            200
        Evdev Wheel Emulation Button (237):             2
        Evdev Drag Lock Buttons (238):          0

Solution reproduced above from "vace117"