3

I have a computer (in fact, a Banana Pi Pro) with a touchscreen which I have configured to emulate the right click via xorg.conf:

Section "InputClass"
    Identifier "Touchscreen"
    Option "EmulateThirdButton" "1"
    Option "EmulateThirdButtonTimeout" "750"
    Option "EmulateThirdButtonThreshold" "30"
EndSection

This works really well. But sometimes, when I want to use a real mouse, these settings become quite annoying, because long left mouse clicks are converted to right mouse clicks. Also, drag selection becomes imprecise because of 30 pixels threshold.

I wonder if it's possible to disable the right click emulation when the mouse is used:

  1. Is it possible to modify Xorg configuration at runtime to alter the "InputClass" section?

  2. If not, is it possible to apply this section only to one particular input device (the touchscreen)?

  3. If the only way is to update xorg.conf and restart the server, what would be the least painful way to do it? Ideally it would be nice to preserve the applicatons which are already running, but I doubt it's possible.

  4. Is there a program which does what I want without changing xorg.conf? Like in this question, where xrandr is used to dynamically configure parameters which are static when configured via xorg.conf.

5

xinput controls input settings. It has the same role for input that xrandr has for the display.

Run xinput list to list devices. Each device has a name and a numerical ID. You can use either this name or this ID to list properties of the corresponding device. Device IDs can depend on the order in which the devices are detected, so to target a specific device, use its name. For example, I have a mouse as device 8; here's an excerpt of its properties:

$ xinput list-props 8
…
    Evdev Third Button Emulation (280):     0
    Evdev Third Button Emulation Timeout (281):     1000
    Evdev Third Button Emulation Button (282):      3
    Evdev Third Button Emulation Threshold (283):   20
…

So I can use either of the following commands to turn on third button emulation for this device:

xinput set-prop 8 280 1
xinput set-prop 8 'Evdev Third Button Emulation' 1

There is a hierarchy of devices, which xinput list represents graphically. Applying a property to a device also applies it to its children. For example, you can apply a property to all pointing devices by applying it to the root pointer Virtual core pointer.

  • Thanks! I will try it out this evening and post an update, but I'm quite confident it will work, so I'm accepting your answer now. – Dmitry Grigoryev Aug 20 '15 at 13:14
1

Thanks to @Gilles' answer I installed xinput and discovered what my touchscreen device was called:

xinput list
⎡ Virtual core pointer                          id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ ft5x_ts                                   id=7    [slave  pointer  (2)]
⎜   ↳ GiGa HiD                                  id=9    [slave  pointer  (2)]

With this information I was able to customize my xorg.conf file to only affect the ft5x_ts device (the touchscreen) using MatchProduct parameter:

Section "InputClass"
    Identifier "Touchscreen"
    MatchProduct "ft5x_ts"
    Option "EmulateThirdButton" "1"
    Option "EmulateThirdButtonTimeout" "750"
    Option "EmulateThirdButtonThreshold" "30"
EndSection

After a reboot, right click emulation was effective only on the touchscreen.

PS: perhaps it is worth mentioning that my computer is based on Banana Pi Pro with an LCD module from LeMaker, so that other Banana Pi folk could find this topic.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.