Bug 101908

Summary: Left-handed mouse: tap produces right click
Product: xorg Reporter: Artemy Tregubenko <me>
Component: Input/synapticsAssignee: Peter Hutterer <peter.hutterer>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: medium CC: peter.hutterer
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Artemy Tregubenko 2017-07-24 21:06:46 UTC
First of all I’d like to say that documenting a bug doesn’t justify its existence.

The issue I am reporting is documented in `man synaptics`: 

> If the device is switched to left-handed (an in-server mapping of physical buttons 1, 2, 3 to the logical buttons 3, 2, 1, respectively), both physical and TapButtons are affected. To counteract this, the TapButtons need to be set up in reverse order (TapButton1=3, TapButton2=1).

Steps to reproduce: 

0) "Tap to click" is activated (by default), your computer has a touchpad
1) Switch mouse and touchpad to the left-handed mode through Settings > Mouse and Touchpad
2) Logout and login for the changes to take effect
3) Tap the touchpad

Expected result: a left click event is generated
Actual result: right click event is generated, context menu is shown

Steps to work around the problem (no sane person will consider this a real solution):
1) Find in `man synaptics` the lines quoted above
2) Find out the syntax of xinput to configure Tap Action (not in the `man xinput` since this particular case is not mentioned there, and not via xorg.conf which ceased to exist)
3) Run this command via an entry in .config/autostart (since putting it in .profile and .xinputrc doesn’t have any effect)

These configuration steps MUST NOT (RFC 2119) exist. Tapping the touchpad should continue to work normally even after switching the mouse to the left-handed mode. 

For the next poor soul trying to figure out the command to run: 
1) Run `xinput` and find your touchpad there, remember its ID
2) Run `xinput list-props <ID> | grep "Tap Action"`, remember property ID
3) Run `xinput set-prop --type=int --format=8 <ID> <PROP> 2 3 0 0 1 3 0` on login by adding it to "Startup applications"
Comment 1 Peter Hutterer 2017-07-25 10:39:59 UTC
fwiw, xinput set-prop "device name" "property name" val1 val2 val3... works too, no need to use IDs and it's not necessary to specify --type and --format

that aside, this is a long-standing design issue with the way how left-handed mapping works in X, specifically that switching a device to left-handed mode is handled by the X server, not the driver. The driver isn't aware of it, and the server does not know whether a button event is caused by the button or tapping. Hence the workaround.

This has unfortunately been an issue for years, it is not easily fixable without breaking clients. fwiw, libinput and the xorg-x11-drv-libinput driver handles this use-case correctly, but it is not something that will ever get fixed for the synaptics driver, sorry.
Comment 2 Artemy Tregubenko 2017-07-25 19:27:06 UTC
Thank you for explaining the issue, and I hope you don’t mind answering a couple of further questions. 

What exactly changes "Synaptics Tap Action" to "2 3 0 0 2 3 0" from "2 3 0 0 1 3 0"?
Comment 3 Peter Hutterer 2017-07-26 20:47:30 UTC
either some xorg.conf snippet that is installed (if any) or your desktop environment. but this balue seems a bit strange, it does a middle/right finger setting for 1/2 finger tap, respectively? for left-handed, i'd expect 0 0 0 0 3 1 0. Are you intentionally setting the corner buttons too (the first 2 values)?
Comment 4 Artemy Tregubenko 2017-07-26 21:30:31 UTC
This is default Ubuntu setup in my case
Comment 5 Artemy Tregubenko 2017-07-26 21:54:14 UTC
Maybe with your knowledge of internals you could help me find the cause of this?

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.