If the device is mapped 3 2 1, a click on physical button 1 sends a button 3
press, but the state was set for button 1. Fix this, the state must be set
for that button's logical mapping.
Patch here: http://patchwork.freedesktop.org/patch/8367/
This is fixed on master and in server-1.11-branch.
Author: Peter Hutterer <firstname.lastname@example.org>
Date: Fri Dec 16 12:41:08 2011 +1000
dix: button state must show the logical buttons, not physical buttons
In a file near to this fix, dix/events.c, I see a similar idiom to the one being patched here. Look for mouse->button->down. Should that one get the same treatment? One other occurrence in the same directory (dix/enterleave.c) is already like the patched version.
I checked https://cgit.freedesktop.org/xorg/xserver/tree/dix/events.c to see if I wasn't looking at an old version.