Bug 87402

Summary: Allow fake middle button on clickpads
Product: Wayland Reporter: Tom Hughes <tom>
Component: libinputAssignee: Wayland bug list <wayland-bugs>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: medium CC: benjamin.tissoires, bugzilla, jadahl, jwrdegoede, peter.hutterer
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 85534    
Attachments: Enable middle button support for the bottom button pad
Add a middle button to the bottom button pad

Description Tom Hughes 2014-12-17 08:43:46 UTC
Created attachment 110941 [details]
Enable middle button support for the bottom button pad

Currently libinput only supports a middle button in the top button pad area, where it always exists from the 42% mark to the 58% mark  horizontally.

I'd like to see support for an optional middle button in the bottom button pad area as I believe it is fairly common for people to fake that up presently with the current drviers, which allows the boundaries to be defined with the "SoftButtonAreas" option.

I'm attaching two patches. The first just adds support for a middle button at the bottom but doesn't actually create one as it leaves the left and right buttons abutting each other.

The second unconditionally adds a middle button from 42% to 58% as for the top button area.

If you're happy with the general idea then I would propose that the second patch be made conditional on a single "fake middle button" option, rather than adding a general ability to specify the areas.
Comment 1 Tom Hughes 2014-12-17 08:44:18 UTC
Created attachment 110942 [details] [review]
Add a middle button to the bottom button pad
Comment 2 Peter Hutterer 2014-12-17 23:20:53 UTC
The main question here: we do middle button emulation on left+right click - is this not enough and why?


one of the things we're trying to do is stick to what the HW manufacturer intended (within reason of course). Clickpads often have the left/right buttons marked on the touchpad but there is no marker for a middle button (except on the T440 series, that's why we enable it there). So it's not clear where exactly that middle button should sit on each touchpad. On an x220 for example, the area that is not clearly marked as L/R button is too small to be a middle button.

Lenovo for example allows a million config settings, but no middle button:
http://shop.lenovo.com/us/en/laptops/thinkpad/trackpad/?bctid=3428890606001
(Windows doesn't use the middle button as much, that may just be the explanation)

For the patches: once a middle button was enabled, the middle button emulation should be disabled. which brings up the question of what events to send in that case (L+R seems fine tbh)

A configuration option for that would be necessary, but I don't think it should be "enable middle button" but rather "has middle button emulation". this way it can be automatically enabled on touchpads and conditionally enabled on mice (Bug 85534)
Comment 3 Peter Hutterer 2014-12-17 23:22:00 UTC
One more comment (that's why I cc'd Bastien): libinput only exposes configurations to the compositor. If those have no plans on implementing a toggle to this particular setting, having it is rather pointless. Bastien - any plans here?
Comment 4 Bastien Nocera 2014-12-18 06:46:43 UTC
(In reply to Peter Hutterer from comment #3)
> One more comment (that's why I cc'd Bastien): libinput only exposes
> configurations to the compositor. If those have no plans on implementing a
> toggle to this particular setting, having it is rather pointless. Bastien -
> any plans here?

We never exposed middle-button emulation as a UI setting, and we don't plan to in the future either. Given my hate for soft-buttons, and the fact that three-finger clicks should work on the majority of recent touchpads, I'm not sure that plan is about to change.
Comment 5 Tom Hughes 2014-12-18 19:11:08 UTC
So I've been investgating a bit more to try and discover why I currently have my laptop setup with a fake middle button (as you say, the clickpad is just marked with one line in the middle) and I think I have figured out the history...

My previous laptop had physical buttons and middle click was emulated when both were pressed together, which wasn't ideal as it's a bit fiddly for something that I do very often, but wasn't terrible.

When I replaced it the new one had a clickpad and it seems I discovered what I have just rediscovered while trying to enable middle click emulation - the current synaptics X driver doesn't support middle click emulation (by pressing left and right together) for cickpads!

Having discovered however that I could define custom boundaries to create an unmarked middle button I went with that, which is also a bit more convenient than for a common operation like pasting.

I was unaware until just now that clicking with three fingers also did middle mouse - that does indeed work with synaptics but it's very fiddly.

So if the new libinput driver does support middle as left+right then that's probably not as bad as I thought it would be, though a fake middle button would certainly give easier access to middle button functionality.
Comment 6 Peter Hutterer 2014-12-18 21:59:30 UTC
(In reply to Tom Hughes from comment #5)
> When I replaced it the new one had a clickpad and it seems I discovered what
> I have just rediscovered while trying to enable middle click emulation - the
> current synaptics X driver doesn't support middle click emulation (by
> pressing left and right together) for cickpads!

yeah, the synaptics driver doesn't really handle multitouch correctly. half of that is legacy code, the other half the nightmare of rewriting much of the driver without breaking all options that synaptics provides. so when we added software buttons, we added the ability for the middle button.
amongst other things, such historical accidents are what we're trying to get rid of in libinput.

> I was unaware until just now that clicking with three fingers also did
> middle mouse - that does indeed work with synaptics but it's very fiddly.

yeah, three finger tap and click with three fingers down will both trigger the middle click. the latter doesn't work with libinput yet (Bug 85530)

> So if the new libinput driver does support middle as left+right then that's
> probably not as bad as I thought it would be, though a fake middle button
> would certainly give easier access to middle button functionality.

right. what I'd like to focus on is making the left+right middle click less fiddly so it is a reliable way of triggering middle clicks. If you could help us out with that, that'd be appreciated. Meanwhile, I think I'm going to stand by my "no middle software button" stance.
Comment 7 Tom Hughes 2015-01-01 20:29:42 UTC
So I switched my laptop to use libinput about ten days ago and (once I had updated to use libinput and the X driver from rawhide instead of F21) it all seems to work reasonably well - certainly the rawhide version is a big improvement over the F21 version.

As far as the middle button goes I think the left+right click emulation is going to be fine, so I'll close this. It doesn't seem to be completely reliable yet as it sometimes doesn't seem to recognise it as middle click on the first attempt, but if that is cleared things should be fine for my use at least.
Comment 8 Peter Hutterer 2015-01-03 00:09:43 UTC
Thanks for following up on that. If you can figure out why it's not reliable and under which conditions please let us know (file a separate bug, easier to track). It's certainly supposed to work any time.

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.