Bug 4915

Summary: Mouse buttons above 3 conflict with default ZAxisMapping
Product: xorg Reporter: Matthias Hopf <mat>
Component: Input/MouseAssignee: Matthias Hopf <mat>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: high CC: alan.coopersmith, bhughes, daniel, eich, sndirsch, xorg-team
Version: git   
Hardware: x86 (IA32)   
OS: All   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 1690    
Attachments:
Description Flags
Patch for adding a ButtonMapping option
none
Updated patch
none
Proposed fix: move buttonMap initialisation before calling OS specifix PreInit
alan.coopersmith: 6.9/7.0+
Proposed fix 2: Change ButtonMapping default alan.coopersmith: 6.9/7.0+

Description Matthias Hopf 2005-10-28 07:28:06 UTC
On mice with more than 3 mouse buttons the next 4 additional buttons are
inaccessible due to the default ZAxisMapping.

As we do not want to change the ZAxisMapping (buttons 4-7 are configured as
mouse wheel events by most applications by default), we need an input mapping of
the mouse buttons to higher button numbers.
Comment 1 Matthias Hopf 2005-10-28 07:45:29 UTC
Created attachment 3651 [details] [review]
Patch for adding a ButtonMapping option

This patch adds a ButtonMapping option which allows to define arbitrary button
mappings (including left-handed mouse etc.). The default '1 2 3 8 9 10 11 ...'
is suited to circumvent the ZAxisMapping problem.

The patch also fixes some bugs that were encountered during this work, e.g.
ZAxisMapping "1 2" (while not being usefull at all) would typically map the
wheel to Buttons 2 and 3.
The reverseMap was of size 32, of which the top 16 values would never be
addressed.
Hardware state decision was done on button save state that included
ZAxisMapping, but not button reordering.

The patch changes the size of MouseDevRec, so I'm not exactly sure whether I
have to increase OS_MOUSE_VERSION_MINOR. Please comment!
Comment 2 Alan Coopersmith 2005-11-09 08:10:02 UTC
*** Bug 1900 has been marked as a duplicate of this bug. ***
Comment 3 Matthias Hopf 2005-11-09 08:56:09 UTC
Created attachment 3755 [details] [review]
Updated patch

This update adds a man page entry and has some changes for better ABI backward
compatibility.
Comment 4 Matthias Hopf 2005-11-09 09:06:50 UTC
Included in CVS head. 
Comment 5 Matthieu Herrb 2005-11-11 03:17:02 UTC
Sorry, I have issues with this patch:
1. It breaks wsmouse on OpenBSD and NetBSD, because the code initializing the
default pMse->buttonMap is not called when an OS-specific preInit functions is used
2. I wonder if the MMHIT protocol changes at the end of the patch (which also
got committed) belong to the change discussed here. 
Comment 6 Matthieu Herrb 2005-11-11 03:25:40 UTC
Created attachment 3773 [details] [review]
Proposed fix: move buttonMap initialisation before calling OS specifix PreInit
Comment 7 Matthias Hopf 2005-11-11 03:36:47 UTC
You're perfectly right. This should be fixed.
Comment 8 Matthias Hopf 2005-11-11 03:43:25 UTC
Created attachment 3774 [details] [review]
Proposed fix 2: Change ButtonMapping default

As discussed in the xorg mailing list:

The ZAxisMapping has been set default to "4 5 6 7" again, so the ButtonMapping
default should be changed from the one-to-one mapping to "1 2 3 8 9 10 11..."
as well.
Comment 9 Alan Coopersmith 2005-11-11 11:05:31 UTC
I found this problem as well last night on Solaris when using USB mice which
go through the OS-specific mouse code, and neither of these patches fix it,
since the buttonMap is only initialized when "ButtonMapping" is set in the
config file, since otherwise, the default is NULL and if s is NULL, it skips
initializing the button map altogether:
   s = xf86SetStrOption(pInfo->options, "ButtonMapping", NULL);

Should there be a different default if unset?   Or should there be a default
fallback if s comes back as NULL?
Comment 10 Alan Coopersmith 2005-11-11 11:17:30 UTC
Comment on attachment 3773 [details] [review]
Proposed fix: move buttonMap initialisation before calling OS specifix PreInit

Never mind, I misapplied the patch - after looking more carefully and applying
patch from attachment #3773 [details] [review] correctly, I agree that does look correct and fixes
my problem on Solaris, so I'm approving it for checkin to 6.9/7.0 now.	 Please
go ahead and commit.
Comment 11 Alan Coopersmith 2005-11-11 11:18:17 UTC
Comment on attachment 3774 [details] [review]
Proposed fix 2: Change ButtonMapping default

Approving patch from attachment #3774 [details] [review] as well.	Please commit.
Comment 12 Matthias Hopf 2005-11-15 01:22:47 UTC
Applied to CVS.
Comment 13 Alan Coopersmith 2006-04-05 04:57:49 UTC
*** Bug 4504 has been marked as a duplicate of this bug. ***

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.