Bug 103119

Summary: Mouse buttons aren't listed correctly and can't be reassigned
Product: Wayland Reporter: Sergio Costas <raster>
Component: libinputAssignee: Wayland bug list <wayland-bugs>
Status: RESOLVED NOTABUG QA Contact:
Severity: normal    
Priority: medium CC: peter.hutterer, raster
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Sergio Costas 2017-10-05 22:31:51 UTC
I migrated from X to Wayland today and found a problem:

My mouse (a logitech M560) has 9 buttons (left, middle, right, wheel up, wheel down, wheel left, wheel right, and two buttons for the thumb). With Xorg I used xmodmap to remap one of the thumb buttons as the middle button, because it is easier to use.

When I changed to Wayland I tried to do the same with "xinput set-button-map", but I was unable. Xinput says that my mouse has 10 buttons (but in fact it has only 9). When I use "xinput test" to see which event number is assigned to each button, it says that they map to 1, 2, 3, 4, 5, 6, 7, 10 and 11, being 10 and 11 the two thumb buttons.

The problem is that "xinput get-button-map" returns "1 2 3 4 5 6 7 8 9 10" (that's why I say that it says that my mouse has 10 buttons), but if I try to remap the thumb button that emits the event 11 to be used as the middle button, it doesn't work: it is not possible to remap the "11 button" to emit the "2 event" ("middle button"); this is: "xinput set-button-map X 1 11 3 4 5 6 7 8 9 10 2" (being X the mouse device, of course) doesn't work because I'm trying to remap the 11th button, the one that xinput doesn't detect.
Comment 1 Peter Hutterer 2017-10-06 02:15:30 UTC
https://who-t.blogspot.com.au/2016/12/the-future-of-xinput-xmodmap-setxkbmap.html

in short: xmodmap/xinput have no real effect under wayland. any remapping would only work in X applications, not in wayland-native ones. You need to remap the button using the compositor's facilities (if any).
Comment 2 Sergio Costas 2017-10-06 08:34:04 UTC
Oh, ok... I supposed that xmodmap was the tool for Xorg, but xinput was the equivalent for libinput... Ok, thanks.
Comment 3 Sergio Costas 2017-10-06 08:41:27 UTC
But wait... I remapped one of the recognized buttons in my mouse, and the remap works in wayland applications... Specifically, I remapped the thumb button that can be remapped to the middle button, and the paste function works in a gnome terminal or in Gedit :-?
Comment 4 Peter Hutterer 2017-10-08 09:46:37 UTC
I honestly don't know how this would work. xinput only talks to the x server which updates its internal button mapping. In theory it's possible to have this configuration forwarded to the compositor to apply across Wayland applications, but we don't have a protocol for that. So... No idea what's going on there.
Comment 5 Sergio Costas 2017-10-08 10:27:53 UTC
Ok, I found the reason: I don't know what's happening with my Debian system, but when I ask it to run Gnome Shell under Wayland, it still launches the X version. That's why it worked.

If I manually launch gnome shell from a tty with --wayland, and try to use xinput to remap the mouse, it doesn't work.

Sorry.

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.