Bug 104215

Summary: Middle-mouse panning does not work in some applications on ThinkPad touchpad
Product: Wayland Reporter: Niko Montonen <montonen.niko>
Component: libinputAssignee: Wayland bug list <wayland-bugs>
Status: RESOLVED WONTFIX QA Contact:
Severity: enhancement    
Priority: lowest CC: peter.hutterer
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Niko Montonen 2017-12-11 18:51:51 UTC
Hardware: ThinkPad X220
Software: Arch Linux, i3wm under X.Org, libinput 1.9.3

The default configuration for the device "TPPS/2 IBM TrackPoint" sets the property "libinput Button Scrolling Button" to 2.
This configuration causes the "hold mouse3 to pan" functionality to break in certain applications, such as KiCad and FreeCAD.

When the property is set to 3, panning works in KiCad and FreeCAD.
However, in KiCad this then causes the right-click to no longer open the context menu. FreeCAD seems to be unaffected, but I've only spent a few seconds with it (to confirm it was affected in a similar way).
On the other hand, KiCad manages to spawn a context menu with the right-click when using their legacy codepath, that uses software rendering. The context menu is broken in their new OpenGL codepath. I believe I will also have to open a bug report with that project.
You however understand my trouble - behavior is extremely unpredictable.

When a regular USB Plug and Play mouse is connected to laptop, both panning with mouse3 depressed and the right-click context menu work as expected without problems in all use cases.

I've been smashing my head against the walls trying to play with different property values, trying to find a configuration that works, but without success. As such, I have included below anything I could consider relevant.

/etc/X11/xorg.conf.d/30-touchpad.conf:
Section "InputClass"
        Identifier "libinput touchpad catchall"
        MatchIsTouchpad "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
        Option "Tapping" "true"
        Option "TappingDrag" "true"
        Option "HorizontalScrolling" "false"
EndSection

% xinput
⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
⎜   ↳ SynPS/2 Synaptics TouchPad              	id=11	[slave  pointer  (2)]
⎜   ↳ TPPS/2 IBM TrackPoint                   	id=12	[slave  pointer  (2)]
⎣ Virtual core keyboard                   	id=3	[master keyboard (2)]
    ↳ Virtual core XTEST keyboard             	id=5	[slave  keyboard (3)]
    ↳ Power Button                            	id=6	[slave  keyboard (3)]
    ↳ Video Bus                               	id=7	[slave  keyboard (3)]
    ↳ Sleep Button                            	id=8	[slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard            	id=10	[slave  keyboard (3)]
    ↳ ThinkPad Extra Buttons                  	id=13	[slave  keyboard (3)]
    ↳ Integrated Camera: Integrated C         	id=9	[slave  keyboard (3)]

% xinput list-props "SynPS/2 Synaptics TouchPad"
Device 'SynPS/2 Synaptics TouchPad':
	Device Enabled (142):	1
	Coordinate Transformation Matrix (144):	1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
	libinput Tapping Enabled (279):	1
	libinput Tapping Enabled Default (280):	0
	libinput Tapping Drag Enabled (281):	1
	libinput Tapping Drag Enabled Default (282):	1
	libinput Tapping Drag Lock Enabled (283):	0
	libinput Tapping Drag Lock Enabled Default (284):	0
	libinput Tapping Button Mapping Enabled (285):	1, 0
	libinput Tapping Button Mapping Default (286):	1, 0
	libinput Natural Scrolling Enabled (287):	0
	libinput Natural Scrolling Enabled Default (288):	0
	libinput Left Handed Enabled (289):	0
	libinput Left Handed Enabled Default (290):	0
	libinput Accel Speed (291):	0.000000
	libinput Accel Speed Default (292):	0.000000
	libinput Scroll Methods Available (293):	1, 1, 0
	libinput Scroll Method Enabled (294):	1, 0, 0
	libinput Scroll Method Enabled Default (295):	1, 0, 0
	libinput Click Methods Available (296):	1, 1
	libinput Click Method Enabled (297):	1, 0
	libinput Click Method Enabled Default (298):	1, 0
	libinput Middle Emulation Enabled (299):	0
	libinput Middle Emulation Enabled Default (300):	0
	libinput Send Events Modes Available (264):	1, 1
	libinput Send Events Mode Enabled (265):	0, 0
	libinput Send Events Mode Enabled Default (266):	0, 0
	libinput Disable While Typing Enabled (301):	1
	libinput Disable While Typing Enabled Default (302):	1
	Device Node (267):	"/dev/input/event15"
	Device Product ID (268):	2, 7
	libinput Drag Lock Buttons (303):	<no items>
	libinput Horizontal Scroll Enabled (304):	0

% xinput list-props "TPPS/2 IBM TrackPoint"     
Device 'TPPS/2 IBM TrackPoint':
	Device Enabled (142):	1
	Coordinate Transformation Matrix (144):	1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
	libinput Natural Scrolling Enabled (287):	0
	libinput Natural Scrolling Enabled Default (288):	0
	libinput Left Handed Enabled (289):	0
	libinput Left Handed Enabled Default (290):	0
	libinput Accel Speed (291):	0.000000
	libinput Accel Speed Default (292):	0.000000
	libinput Accel Profiles Available (305):	1, 1
	libinput Accel Profile Enabled (306):	1, 0
	libinput Accel Profile Enabled Default (307):	1, 0
	libinput Scroll Methods Available (293):	0, 0, 1
	libinput Scroll Method Enabled (294):	0, 0, 1
	libinput Scroll Method Enabled Default (295):	0, 0, 1
	libinput Button Scrolling Button (308):	2
	libinput Button Scrolling Button Default (309):	2
	libinput Middle Emulation Enabled (299):	0
	libinput Middle Emulation Enabled Default (300):	0
	libinput Send Events Modes Available (264):	1, 0
	libinput Send Events Mode Enabled (265):	0, 0
	libinput Send Events Mode Enabled Default (266):	0, 0
	Device Node (267):	"/dev/input/event17"
	Device Product ID (268):	2, 10
	libinput Drag Lock Buttons (303):	<no items>
	libinput Horizontal Scroll Enabled (304):	1
Comment 1 Niko Montonen 2017-12-11 18:54:12 UTC
I have also opened a bug report on KiCad's bug report system, as there are so many layers between my input device (ThinkPad X220 touchpad) and the application (KiCad) that I'm not sure where to even begin. Given that both libinput and KiCad are giving me behavior that I consider inconsistent.

https://bugs.launchpad.net/kicad/+bug/1737596
Comment 2 Niko Montonen 2017-12-12 05:49:37 UTC
As per a user on the #wayland IRC, setting "libinput Scroll Method Enabled" to all zeroes (to disable the button scroll method) fixes this problem.

But I'll be leaving this open so someone more knowledgeable can make a judgment call as to if enabling button scrolling by default is a good idea, when it can break applications like this.
Comment 3 Peter Hutterer 2017-12-13 05:42:33 UTC
What you're seeing is the effect of button scrolling:
https://wayland.freedesktop.org/libinput/doc/latest/scrolling.html#button_scrolling

That's enabled on some devices, most notably trackpoints. And it's going to stay that way, sorry. It's very uncommon to have to middle button+pan but it's very common to have to scroll up/down.

Note that there is *no* correct default, we simply have to chose which use-case doesn't work out of the box. And wWe're erring on the side of the more common use-case here. This is a default only, so it can be disabled.

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.