Wednesday, April 6, 2016

libinput now has a touchpad software middle button

I just pushed a patch to libinput master to enable a middle button on the clickpad software buttons. Until now, our stance was that clickpads only get a left and right software button, split at the 50% mark. The reasoning is simple: touchpads only have markings for left and right buttons (if any!) and the middle button's extents are not easily discoverable if there is no visual or haptic feedback. A middle button event could however be triggered through middle button emulation, i.e. by clicking the touchpad with a finger on the left and right software button area (see the instructions here).

This is nice in theory but, as usual, reality gets in the way. Most interactions with the middle button are quick and short-lived, i.e. clicking the button once to paste. This interaction is what many touchpads are spectacularly bad at. For middle button emulation to be handled correctly, both fingers must be registered before the physical button press. The scanout rate on a touchpad is often too low and on touchpads with extremely light resistance like the T440 it's common to register the physical click before we know that there's a second finger on the touchpad. But even on a T450 and an X220 with much higher clickpad resistance I barely managed to get above 7 out of 10 correctly registered middle button events. That is simply not good enough.

So the patch I just pushed out to master enables a middle software button between the left and the right button. The exact width of the button scales with the touchpad but it's usually around 20-25mm and it's centered on the touchpad so despite the lack of visual or haptic guides it should be reliable to hit. The new behaviour is hard-coded and for now middle button emulation continues to work on touchpads. In the future, I expect I will remove middle button emulation on touchpads or at least disable it by default.

The middle button will be available in libinput 1.3.


KAMiKAZOW said...

Now add an option to disable vertical two finger scrolling everywhere and I'll name my firstborn after you. :-)

Peter Hutterer said...

I think enabling edge scrolling should be good enough?

KAMiKAZOW said...

Damn, I mistyped. I meant horizontal scolling.
My cheap laptop's touchpad has horrible horizontal scrolling. It's hard to put my finger on it (no pun intended) what's actually wrong but horizontal scrolling feels really strange with it.

Peter Hutterer said...

Right. The decision was to let the caller decide on how to handle horizontal scrolling. Ideally and eventually, it'll be up to the widgets depending on the semantic context. If you're using the xf86-input-libinput driver, it does have a property and config option to disable horiz scrolling. See man libinput.

druedain said...


That sound really good. At the moment mid button emulation with clicking left and right is not the best and I usually got some problems with properly triggering it.

Question: is there any release schedule for libinput or 1.3 will be released „when it's ready”?

Peter Hutterer said...

druedain: "when it's ready", but should be soon enough